使用代码创建Laravel护照客户端

时间:2017-06-19 05:17:31

标签: laravel-5 laravel-passport

有没有人知道使用代码创建护照客户端,因为我可以使用命令创建它但是如何使用代码实现它?

非常感谢您的帮助。

提前致谢

1 个答案:

答案 0 :(得分:5)

我是由我自己完成的,以下是通过代码手动生成oAuth客户端的代码段。

$oauth_client = new oAuthClient();
$oauth_client->user_id =  $last_inserted_id;
$oauth_client->name =  $user->name;
$oauth_client->secret =base64_encode(hash_hmac('sha256',Hash::make($_REQUEST['password']), 'secret', true));
$oauth_client->password_client=1;
$oauth_client->personal_access_client   =  0;
$oauth_client->redirect =  'redirect_uri';
$oauth_client->revoked=  0;
$oauth_client->save(); // Saving oauth client