PHP code example of cofa / laravel-authentication-flow
1. Go to this page and download the library: Download cofa/laravel-authentication-flow library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cofa / laravel-authentication-flow example snippets
namespace App\Models;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements JWTSubject
{
use Notifiable;
// ...
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
}
return [
'token_ttl' => 60, // Access token lifetime in minutes
'refresh_ttl' => 10080, // Refresh token lifetime in minutes (7 days)
'guard' => 'api', // The authentication guard to use
];