1model news.php
2
3 class new extends Model
4 {
5 use HasFactory;
6
7 protected $fillable = ['title' , 'new'];
8 }
9
10NewsFactory.php
11
12 public function definition()
13 {
14 return [
15 'title' => $this->faker->text(rand(10,40)),
16 'new' => $this->faker->text(rand(200,400))
17 ];
18 }
19
20NewsSeeder.php
21
22 public function run()
23 {
24 ini_set('memory_limit' , '512M');
25
26 // generate 100 news
27 \App\Models\Noticia::factory(100)->create();
28 }
29
30In the end, execute the command: php artisan db:seed --class=NewsSeeder