Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

factory laravel

php artisan make:factory CommentFactory
  
  return [
      'name' => $this->faker->name,
      'text' => $this->faker->text()
    ];

public function run()
{
  Comment::factory()
    ->times(3)
    ->create();
}

php artisan db:seed
  
 
PREVIOUS NEXT
Tagged: #factory #laravel
ADD COMMENT
Topic
Name
3+7 =