July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, we need to update the User model so that we can start to protect the API endpoints with user authentication.
First, we need to implement the Tymon\JWTAuth\Contracts\JWTSubject contract on our User model, which requires two methods: getJWTIdentifier() and getJWTCustomClaims().
Open project/User.php and replace its content with the following code:
<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; use Tymon\JWTAuth\Contracts\JWTSubject; /** * @SWG\Definition( * definition="User", * required={"name", "email", "password"}, * @SWG\Property( * property="name", * type="string", * description="User name", * example="John Conor" * ), * @SWG\Property( ...Read now
Unlock full access