1 | <?php |
||
12 | class Agent extends Model |
||
13 | { |
||
14 | use ValidatingTrait; |
||
15 | use CacheableEloquent; |
||
16 | |||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | protected $fillable = [ |
||
21 | 'name', |
||
22 | 'kind', |
||
23 | 'family', |
||
24 | 'version', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected $casts = [ |
||
31 | 'name' => 'string', |
||
32 | 'kind' => 'string', |
||
33 | 'family' => 'string', |
||
34 | 'version' => 'string', |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | public $timestamps = false; |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | protected $observables = [ |
||
46 | 'validating', |
||
47 | 'validated', |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * The default rules that the model will validate against. |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $rules = [ |
||
56 | 'name' => 'required|string|strip_tags|max:150', |
||
57 | 'kind' => 'required|string|strip_tags|max:150', |
||
58 | 'family' => 'required|string|strip_tags|max:150', |
||
59 | 'version' => 'nullable|string|strip_tags|max:150', |
||
60 | ]; |
||
61 | |||
62 | /** |
||
63 | * Whether the model should throw a |
||
64 | * ValidationException if it fails validation. |
||
65 | * |
||
66 | * @var bool |
||
67 | */ |
||
68 | protected $throwValidationExceptions = true; |
||
69 | |||
70 | /** |
||
71 | * Create a new Eloquent model instance. |
||
72 | * |
||
73 | * @param array $attributes |
||
74 | */ |
||
75 | public function __construct(array $attributes = []) |
||
81 | |||
82 | /** |
||
83 | * The agent may have many requests. |
||
84 | * |
||
85 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
86 | */ |
||
87 | public function requests(): HasMany |
||
91 | } |
||
92 |