24 lines
643 B
PHP
24 lines
643 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\News;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class NewsFactory extends Factory
|
|
{
|
|
protected $model = News::class;
|
|
|
|
public function definition()
|
|
{
|
|
$title = $this->faker->sentence(6);
|
|
return [
|
|
'title' => $title,
|
|
'slug' => Str::slug($title),
|
|
'content' => $this->faker->paragraphs(3, true),
|
|
'image' => 'news/' . $this->faker->image('public/storage/news', 640, 480, null, false),
|
|
'published_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
|
|
];
|
|
}
|
|
}
|