Manage Laravel Passport personal access tokens.
- PHP >= 7.1.3
- Laravel 5.8.* (https://laravel.com)
- Laravel Nova 2.* (https://nova.laravel.com)
-
composer require "64robots/nova-passport-access-tokens:*"
-
Add the tool to your
app\Providers\NovaServiceProvider.php
:public function tools() { return [ // ... new R64\NovaPassportAccessTokens\NovaPassportAccessToken\NovaPassportAccessToken, ]; }
-
Implement
R64\NovaPassportAccessTokens\NovaIssuableToken
in yourApp\Models\Users
namespace App\Models\User;
use Illuminate\Database\Eloquent\Collection;
class User extends Authenticatable implements NovaIssuableToken
{
public static function getForNova(): Collection
{
//
}
}
- Implement
R64\NovaPassportAccessTokens\ScopeForNova
in yourApp\Models\Token
namespace App\Models\Token;
use R64\NovaPassportAccessTokens\ScopeForNova;
class Token extends \Laravel\Passport\Token implements ScopeForNova
{
public function scopeForNova($query)
{
//
}
}
- Use
App\Models\Token
inAppServiceProvider
namespace App\Providers;
use App\Models\Token;
use Illuminate\Support\ServiceProvider;
use Laravel\Passport\Passport;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Passport::useTokenModel(Token::class);
}
}