1 | <?php |
||
11 | class AuthCode extends Model |
||
12 | { |
||
13 | use ValidatingTrait; |
||
14 | |||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | */ |
||
18 | protected $fillable = [ |
||
19 | 'identifier', |
||
20 | 'user_id', |
||
21 | 'user_type', |
||
22 | 'client_id', |
||
23 | 'is_revoked', |
||
24 | 'expires_at', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected $casts = [ |
||
31 | 'identifier' => 'string', |
||
32 | 'user_id' => 'integer', |
||
33 | 'user_type' => 'string', |
||
34 | 'client_id' => 'integer', |
||
35 | 'is_revoked' => 'boolean', |
||
36 | 'expires_at' => 'datetime', |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | protected $observables = [ |
||
43 | 'validating', |
||
44 | 'validated', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * The default rules that the model will validate against. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $rules = []; |
||
53 | |||
54 | /** |
||
55 | * Whether the model should throw a |
||
56 | * ValidationException if it fails validation. |
||
57 | * |
||
58 | * @var bool |
||
59 | */ |
||
60 | protected $throwValidationExceptions = true; |
||
61 | |||
62 | /** |
||
63 | * Create a new Eloquent model instance. |
||
64 | * |
||
65 | * @param array $attributes |
||
66 | */ |
||
67 | public function __construct(array $attributes = []) |
||
81 | |||
82 | /** |
||
83 | * Get the client that owns the authentication code. |
||
84 | * |
||
85 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
86 | */ |
||
87 | public function client() |
||
91 | |||
92 | /** |
||
93 | * Get the user that the client belongs to. |
||
94 | * |
||
95 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
96 | */ |
||
97 | public function user(): MorphTo |
||
101 | } |
||
102 |