Are you using a seeder? If not, that's a great way to get any amount of dummy data you need into your app.
Jul 16, 2019
2
Level 5
How to multiply number of rows in result set Testing pagination
Hello, Testing pagination in laravel 5 app with request
$modelsList = Model
::getByStatus('A')
->get();
I have difficulties as there are too few data in Model table. If there is a way with eloquent/collection to multiply number of rows in result set with less code as possible and easy to return ?
Ex : In my case I got 5 rows, as the app is at dev stage with some default data from migration. but I would easily have, 50, 200, 500 rows.
Thanks!
Level 74
For dummy data use a factory to generate it
Something like
factory(Model::class, 100)->create();
Would create 100 records in your database.
https://laravel.com/docs/5.8/database-testing#writing-factories
https://laravel.com/docs/5.8/database-testing#using-factories
1 like
Please or to participate in this conversation.