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