Changeset View
Changeset View
Standalone View
Standalone View
src/app/PassportClient.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use Illuminate\Database\Eloquent\Collection; | use Illuminate\Database\Eloquent\Collection; | ||||
/** | /** | ||||
* Passport Client extended with allowed scopes | * Passport Client extended with allowed scopes | ||||
*/ | */ | ||||
class PassportClient extends \Laravel\Passport\Client | class PassportClient extends \Laravel\Passport\Client | ||||
{ | { | ||||
public function __construct(array $attributes = []) | /** @var array<string, string> The attributes that should be cast */ | ||||
{ | protected $casts = [ | ||||
$this->mergeCasts([ | |||||
'allowed_scopes' => 'array', | 'allowed_scopes' => 'array', | ||||
]); | ]; | ||||
parent::__construct($attributes); | |||||
} | |||||
public function getAllowedScopes(): array | public function getAllowedScopes(): array | ||||
{ | { | ||||
if ($this->allowed_scopes) { | if ($this->allowed_scopes) { | ||||
return $this->allowed_scopes; | return $this->allowed_scopes; | ||||
} | } | ||||
return []; | return []; | ||||
} | } | ||||
} | } |