1 | <?php |
||
13 | class Client extends Model |
||
14 | { |
||
15 | use HasTranslations; |
||
16 | use ValidatingTrait; |
||
17 | |||
18 | /** |
||
19 | * The attributes excluded from the model's JSON form. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $hidden = [ |
||
24 | 'secret', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * The temporary plain-text client secret. |
||
29 | * |
||
30 | * @var string|null |
||
31 | */ |
||
32 | protected $plainSecret; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | protected $fillable = [ |
||
38 | 'user_id', |
||
39 | 'user_type', |
||
40 | 'name', |
||
41 | 'secret', |
||
42 | 'redirect', |
||
43 | 'grant_type', |
||
44 | 'is_revoked', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | protected $casts = [ |
||
51 | 'user_id' => 'integer', |
||
52 | 'user_type' => 'string', |
||
53 | 'name' => 'string', |
||
54 | 'secret' => 'string', |
||
55 | 'redirect' => 'string', |
||
56 | 'grant_type' => 'string', |
||
57 | 'is_revoked' => 'boolean', |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | protected $observables = [ |
||
64 | 'validating', |
||
65 | 'validated', |
||
66 | ]; |
||
67 | |||
68 | /** |
||
69 | * The attributes that are translatable. |
||
70 | * |
||
71 | * @var array |
||
72 | */ |
||
73 | public $translatable = [ |
||
74 | 'name', |
||
75 | ]; |
||
76 | |||
77 | /** |
||
78 | * The default rules that the model will validate against. |
||
79 | * |
||
80 | * @var array |
||
81 | */ |
||
82 | protected $rules = []; |
||
83 | |||
84 | /** |
||
85 | * Whether the model should throw a |
||
86 | * ValidationException if it fails validation. |
||
87 | * |
||
88 | * @var bool |
||
89 | */ |
||
90 | protected $throwValidationExceptions = true; |
||
91 | |||
92 | /** |
||
93 | * Create a new Eloquent model instance. |
||
94 | * |
||
95 | * @param array $attributes |
||
96 | */ |
||
97 | public function __construct(array $attributes = []) |
||
112 | |||
113 | /** |
||
114 | * Get the user that the client belongs to. |
||
115 | * |
||
116 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
117 | */ |
||
118 | public function user(): MorphTo |
||
122 | |||
123 | /** |
||
124 | * Get all of the authentication codes for the client. |
||
125 | * |
||
126 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
127 | */ |
||
128 | public function authCodes() |
||
132 | |||
133 | /** |
||
134 | * Get all of the tokens that belong to the client. |
||
135 | * |
||
136 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
137 | */ |
||
138 | public function accessTokens() |
||
142 | |||
143 | /** |
||
144 | * Get a valid token instance for the given user and client. |
||
145 | * |
||
146 | * @param \Illuminate\Database\Eloquent\Model $user |
||
147 | * |
||
148 | * @return \Rinvex\Oauth\Models\AccessToken|null |
||
149 | */ |
||
150 | public function getValidToken($user) |
||
159 | |||
160 | /** |
||
161 | * Find a valid token for the given user and client. |
||
162 | * |
||
163 | * @param \Illuminate\Database\Eloquent\Model $user |
||
164 | * |
||
165 | * @return \Rinvex\Oauth\Models\AccessToken|null |
||
166 | */ |
||
167 | public function findValidToken($user) |
||
177 | |||
178 | /** |
||
179 | * The temporary non-hashed client secret. |
||
180 | * |
||
181 | * This is only available once during the request that created the client. |
||
182 | * |
||
183 | * @return string|null |
||
184 | */ |
||
185 | public function getPlainSecretAttribute() |
||
189 | |||
190 | /** |
||
191 | * Set the value of the secret attribute. |
||
192 | * |
||
193 | * @param string|null $value |
||
194 | * |
||
195 | * @return void |
||
196 | */ |
||
197 | public function setSecretAttribute($value) |
||
209 | |||
210 | /** |
||
211 | * Determine if the client is a "first party" client. |
||
212 | * |
||
213 | * @return bool |
||
214 | */ |
||
215 | public function firstParty() |
||
219 | |||
220 | /** |
||
221 | * Determine if the client should skip the authorization prompt. |
||
222 | * |
||
223 | * @return bool |
||
224 | */ |
||
225 | public function skipsAuthorization() |
||
229 | |||
230 | /** |
||
231 | * Determine if the client is a confidential client. |
||
232 | * |
||
233 | * @return bool |
||
234 | */ |
||
235 | public function isConfidential() |
||
239 | |||
240 | /** |
||
241 | * Revoke current client and its tokens. |
||
242 | * |
||
243 | * @return void |
||
244 | */ |
||
245 | public function revoke() |
||
250 | } |
||
251 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.