问题
Laravel passport Client
model has this fields on oauth_clients
table:
name
secret
redirect
personal_access_client
password_client
revoked
And how I can add my custom filed request_domain_name
to client credentials for check requesting domain name with this custom field value on every request?
回答1:
You can create a separate migration
php artisan make:migration alter_oauth_clients_table_request_domain_name --table=oauth_clients
and inside your migration define new column
Schema::table('oauth_clients', function (Blueprint $table) {
$table->string('request_domain_name');
});
After that, you can extend Client
model and add request_domain_name
column to fillable
property, than you'll be able to check it.
class Client extends \Laravel\Passport\Client
{
protected $fillable = [
'name',
'secret',
'redirect',
'personal_access_client',
'password_client',
'revoked',
'request_domain_name',
];
}
来源:https://stackoverflow.com/questions/56285892/how-to-add-custom-field-to-laravel-passport-client-model-and-check-it