1 | <?php |
||
18 | abstract class Bookable extends Model implements Sortable |
||
19 | { |
||
20 | use HasSlug; |
||
21 | use BookableTrait; |
||
22 | use SortableTrait; |
||
23 | use HasTranslations; |
||
24 | use ValidatingTrait; |
||
25 | use CacheableEloquent; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | protected $fillable = [ |
||
31 | 'name', |
||
32 | 'title', |
||
33 | 'description', |
||
34 | 'is_active', |
||
35 | 'price', |
||
36 | 'unit', |
||
37 | 'currency', |
||
38 | 'style', |
||
39 | 'sort_order', |
||
40 | 'capacity', |
||
41 | 'early_booking_limit', |
||
42 | 'late_booking_limit', |
||
43 | 'late_cancellation_limit', |
||
44 | 'maximum_booking_length', |
||
45 | 'minimum_booking_length', |
||
46 | 'booking_interval_limit', |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | protected $casts = [ |
||
53 | 'name' => 'string', |
||
54 | 'title' => 'string', |
||
55 | 'description' => 'string', |
||
56 | 'is_active' => 'boolean', |
||
57 | 'price' => 'number', |
||
58 | 'unit' => 'string', |
||
59 | 'currency' => 'string', |
||
60 | 'style' => 'string', |
||
61 | 'sort_order' => 'integer', |
||
62 | 'capacity' => 'integer', |
||
63 | 'early_booking_limit' => 'integer', |
||
64 | 'late_booking_limit' => 'integer', |
||
65 | 'late_cancellation_limit' => 'integer', |
||
66 | 'maximum_booking_length' => 'integer', |
||
67 | 'minimum_booking_length' => 'integer', |
||
68 | 'booking_interval_limit' => 'integer', |
||
69 | 'deleted_at' => 'datetime', |
||
70 | ]; |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | protected $observables = [ |
||
76 | 'validating', |
||
77 | 'validated', |
||
78 | ]; |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public $translatable = [ |
||
84 | 'title', |
||
85 | 'description', |
||
86 | ]; |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public $sortable = [ |
||
92 | 'order_column_name' => 'sort_order', |
||
93 | ]; |
||
94 | |||
95 | /** |
||
96 | * The default rules that the model will validate against. |
||
97 | * |
||
98 | * @var array |
||
99 | */ |
||
100 | protected $rules = []; |
||
101 | |||
102 | /** |
||
103 | * Get the active resources. |
||
104 | * |
||
105 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
106 | * |
||
107 | * @return \Illuminate\Database\Eloquent\Builder |
||
108 | */ |
||
109 | public function scopeActive(Builder $builder): Builder |
||
113 | |||
114 | /** |
||
115 | * Get the inactive resources. |
||
116 | * |
||
117 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
118 | * |
||
119 | * @return \Illuminate\Database\Eloquent\Builder |
||
120 | */ |
||
121 | public function scopeInactive(Builder $builder): Builder |
||
125 | |||
126 | /** |
||
127 | * Get the options for generating the slug. |
||
128 | * |
||
129 | * @return \Spatie\Sluggable\SlugOptions |
||
130 | */ |
||
131 | public function getSlugOptions(): SlugOptions |
||
138 | |||
139 | /** |
||
140 | * Activate the resource. |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function activate() |
||
150 | |||
151 | /** |
||
152 | * Deactivate the resource. |
||
153 | * |
||
154 | * @return $this |
||
155 | */ |
||
156 | public function deactivate() |
||
162 | } |
||
163 |