我有以下IssueToken类:
<?php
namespace App\Http\Controllers\Api\Auth;
use DB;
use App\Client;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
trait IssueTokenTrait
{
public function issueToken(Request $request, $grantType, $scope = "")
{
$params = [
'grant_type' => $grantType,
'client_id' => $this->client->id, // php artisan passport:client --password
'client_secret' => $this->client->secret,
'scope' => $scope
];
$request->request->add($params);
$mail = $request->username;
$clientTable = DB::table('clients')->where('email', $mail)->first();
$client = Client::findOrFail($clientTable->id);
$clientID = $client->id;
$proxy = Request::create('oauth/token', 'POST');
return Route::dispatch($proxy); }
}
返回一个到期的令牌类型和Access令牌以及刷新令牌。
现在我想将Client_id添加到响应中,我该怎么做?