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
  
Source by scotch.io #
 
PREVIOUS NEXT
Tagged: #factory #laravel
ADD COMMENT
Topic
Name
5+4 =