taktik - laravel

This commit is contained in:
2025-01-23 00:19:07 +01:00
commit 43b6cff880
127 changed files with 15025 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace Database\Factories;
use App\Models\Category;
use App\Models\Post;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Post>
*/
class PostFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Post::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'title' => $this->faker->sentence,
'content' => $this->faker->paragraphs(3, true),
'category_id' => Category::inRandomOrder()->first()->id ?? null,
'created_at' => now(),
'updated_at' => now(),
];
}
}