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 | 'slug', |
||
32 | 'name', |
||
33 | 'description', |
||
34 | 'is_active', |
||
35 | 'base_cost', |
||
36 | 'unit_cost', |
||
37 | 'currency', |
||
38 | 'unit', |
||
39 | 'maximum_units', |
||
40 | 'minimum_units', |
||
41 | 'is_recurring', |
||
42 | 'sort_order', |
||
43 | 'capacity', |
||
44 | 'style', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | protected $casts = [ |
||
51 | 'slug' => 'string', |
||
52 | 'name' => 'string', |
||
53 | 'description' => 'string', |
||
54 | 'is_active' => 'boolean', |
||
55 | 'base_cost' => 'float', |
||
56 | 'unit_cost' => 'float', |
||
57 | 'currency' => 'string', |
||
58 | 'unit' => 'string', |
||
59 | 'maximum_units' => 'integer', |
||
60 | 'minimum_units' => 'integer', |
||
61 | 'is_recurring' => 'boolean', |
||
62 | 'sort_order' => 'integer', |
||
63 | 'capacity' => 'integer', |
||
64 | 'style' => 'string', |
||
65 | 'deleted_at' => 'datetime', |
||
66 | ]; |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | protected $observables = [ |
||
72 | 'validating', |
||
73 | 'validated', |
||
74 | ]; |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public $translatable = [ |
||
80 | 'name', |
||
81 | 'description', |
||
82 | ]; |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public $sortable = [ |
||
88 | 'order_column_name' => 'sort_order', |
||
89 | ]; |
||
90 | |||
91 | /** |
||
92 | * The default rules that the model will validate against. |
||
93 | * |
||
94 | * @var array |
||
95 | */ |
||
96 | protected $rules = []; |
||
97 | |||
98 | /** |
||
99 | * Get the active resources. |
||
100 | * |
||
101 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
102 | * |
||
103 | * @return \Illuminate\Database\Eloquent\Builder |
||
104 | */ |
||
105 | public function scopeActive(Builder $builder): Builder |
||
109 | |||
110 | /** |
||
111 | * Get the inactive resources. |
||
112 | * |
||
113 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
114 | * |
||
115 | * @return \Illuminate\Database\Eloquent\Builder |
||
116 | */ |
||
117 | public function scopeInactive(Builder $builder): Builder |
||
121 | |||
122 | /** |
||
123 | * Get the options for generating the slug. |
||
124 | * |
||
125 | * @return \Spatie\Sluggable\SlugOptions |
||
126 | */ |
||
127 | public function getSlugOptions(): SlugOptions |
||
134 | |||
135 | /** |
||
136 | * Activate the resource. |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | public function makeActive() |
||
146 | |||
147 | /** |
||
148 | * Deactivate the resource. |
||
149 | * |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function makeInactive() |
||
158 | } |
||
159 |