그냥 사는 이야기

Laravel 5.3 Tutorial for Beginner - Profile 본문

Development/Web

Laravel 5.3 Tutorial for Beginner - Profile

없다캐라 2020. 1. 19. 04:32
반응형

ProfileController 추가

ProfileController.php
php artisan make:controller ProfileController

Route 추가

web.php
Route::get('/profile/{username}', 'ProfileController@profile');
ProfileController.php
use App\User;
...
public function profile($username)
{
    $user = User::whereUsername($username)->first();
    // User::where('username', $username);
    // User::where('username', '=', $username);
    return $user->email;
}

where에서 3가지 방식이 있음.

Comments