- users
- profiles
- gender
- dob
- race
- religion
$ php artisan make:model Profile -a
This will create:
- Controller
- Model
- Factory
- Migration
Then Setup Route:
// routes/web.php
Route::resource('profiles', 'ProfileController');
Create Seeder:
$ php artisan make:seeder DevelopmentSeeder
Seed specific seeder class:
$ php artisan db:seed --class=DevelopmentSeeder
Eloquent: Eager Load
$ php artisan tinker
>>> $user = \App\User::with('profile')->first();
Eloquent: Lazy Load
$ php artisan tinker
>>> $user = \App\User::first();
>>> $user->load('profile');