Skip to content

Training Web Development with Laravel Framework (Basic) - Collaboration with Terato Tech

Notifications You must be signed in to change notification settings

nasrulhazim/training-laravel-may2019-01

Repository files navigation

Day 2

  • 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');

About

Training Web Development with Laravel Framework (Basic) - Collaboration with Terato Tech

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published