1 | <?php |
||
39 | class Availability extends Model |
||
40 | { |
||
41 | use ValidatingTrait; |
||
42 | use CacheableEloquent; |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | protected $fillable = [ |
||
48 | 'bookable_id', |
||
49 | 'bookable_type', |
||
50 | 'is_available', |
||
51 | 'range', |
||
52 | 'range_from', |
||
53 | 'range_to', |
||
54 | 'priority', |
||
55 | ]; |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | protected $casts = [ |
||
61 | 'bookable_id' => 'integer', |
||
62 | 'bookable_type' => 'string', |
||
63 | 'is_available' => 'boolean', |
||
64 | 'range' => 'string', |
||
65 | 'range_from' => 'string', |
||
66 | 'range_to' => 'string', |
||
67 | 'priority' => 'integer', |
||
68 | ]; |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | protected $observables = [ |
||
74 | 'validating', |
||
75 | 'validated', |
||
76 | ]; |
||
77 | |||
78 | /** |
||
79 | * The default rules that the model will validate against. |
||
80 | * |
||
81 | * @var array |
||
82 | */ |
||
83 | protected $rules = [ |
||
84 | 'bookable_id' => 'required|integer', |
||
85 | 'bookable_type' => 'required|string', |
||
86 | 'is_available' => 'required|boolean', |
||
87 | 'range' => 'required|string|in:unit,date,month,week,day,datetime,time,time-sun,time-mon,time-tue,time-wed,time-thu,time-fri,time-sat', |
||
|
|||
88 | 'range_from' => 'required|string|max:150', |
||
89 | 'range_to' => 'required|string|max:150', |
||
90 | 'priority' => 'nullable|integer', |
||
91 | ]; |
||
92 | |||
93 | /** |
||
94 | * Whether the model should throw a |
||
95 | * ValidationException if it fails validation. |
||
96 | * |
||
97 | * @var bool |
||
98 | */ |
||
99 | protected $throwValidationExceptions = true; |
||
100 | |||
101 | /** |
||
102 | * Create a new Eloquent model instance. |
||
103 | * |
||
104 | * @param array $attributes |
||
105 | */ |
||
106 | public function __construct(array $attributes = []) |
||
112 | |||
113 | /** |
||
114 | * Get the owning resource model. |
||
115 | * |
||
116 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
117 | */ |
||
118 | public function bookable(): MorphTo |
||
122 | } |
||
123 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.