Last active
October 16, 2025 23:14
-
-
Save NandoKstroNet/a29dc84cd19cb70256be04ce8aa8a0aa to your computer and use it in GitHub Desktop.
Migration Media Conteúdo. Saiba mais em https://codeexperts.com.br/courses/videoflix-inertiajs-laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| Schema::create('contents', function (Blueprint $table) { | |
| $table->id(); | |
| $table->string('title'); | |
| $table->uuid('code')->unique(); | |
| $table->string('description')->nullable(); | |
| $table->text('body'); | |
| $table->string('slug')->unique(); | |
| $table->integer('type'); | |
| $table->string('cover')->nullable(); | |
| $table->timestamps(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Database\Factories; | |
| use Illuminate\Database\Eloquent\Factories\Factory; | |
| /** | |
| * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Content> | |
| */ | |
| class ContentFactory extends Factory | |
| { | |
| /** | |
| * Define the model's default state. | |
| * | |
| * @return array<string, mixed> | |
| */ | |
| public function definition(): array | |
| { | |
| $title = fake()->words(3, true); | |
| return [ | |
| 'title' => $title, | |
| 'code' => fake()->uuid(), | |
| 'description' => fake()->sentence, | |
| 'body' => fake()->paragraphs(3, true), | |
| 'slug' => str($title)->slug(), | |
| 'type' => 'MOVIE' | |
| ]; | |
| } | |
| public function series() | |
| { | |
| return $this->state(fn(array $attrs) => ['type' => 'SERIE']); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment