Wednesday, May 19, 2021

Creating a factory in laravel

 Command: PHP artisan make: factory FactoryName

ex: PHP artisan make: factory ProductFactory  or you can make it during creating Model

PHP artisan make: model ModelName --all (it creates a model, controller, factory, seeder, and migration)

in this case, we are creating a factory for Product  so we put Product in the place of the model name

D:\www\crm (main)

λ php artisan make: factory RolesFactory --model=Role

Factory created successfully.

It generates a blank  factory file







No comments:

Post a Comment

Call Factory and make multiple record entry Using tinker

  $d = Factory(App\Department::class,3)->create(); > $d = Factory(App\Department::class, 10)->create(); = Illuminate\Database\Eloqu...