This is an Angular section, but I will take a moment to create a simple relationship, which we will later build a widget around. In this case, I am going to add a favorites
table to the system and relate this to a user. It will hold the information I need to show a comic from Maravel.
Run this inside the virtual machine console:
>php artisan make:migration create_favorites_table
Open this file, and add the
database/migrations/2016_05_16_220136_create_favorites_table.php
fields:Then, make a model for this file:
>php artisan make:model Favorite
In this file, we can add a relationship back to the user:
Then, open the user file called
app/User.php
to relate back to thefavourites
:Now, we are ready to build this UI.