Seeding so you can see how your app looks
The wishlist area we made previously is really tough for me or a product owner to sign off on without some data in there. What I will do in this recipe is show how to seed that area of your website so you can then have a more realistic look at the feature with data.
Getting ready
Just follow the previous recipe called Using factories for migration and tests. After you are done there, the page /wish_lists
should look like this:
How to do it…
The scaffolding from the previous recipe created a new file called
database/seeds/WishListTableSeeder.php
. If you're not using scaffolding, you can easily make these on your own by typing:>php artisan make:seeder WishListTableSeeder
Edit that file so it looks like the following:
Now we need to include that in the core
DatabaseSeeder
filedatabase/seeds/DatabaseSeeder.php
:Now we are ready to run the seeder:
>php artisan migrate:refresh --seed
Now log in and check out that user interface:
How it works…
Alright...