1 | <?php |
||
13 | class TicketableBooking extends Model |
||
14 | { |
||
15 | use ValidatingTrait; |
||
16 | use CacheableEloquent; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | protected $fillable = [ |
||
22 | 'ticket_id', |
||
23 | 'customer_id', |
||
24 | 'paid', |
||
25 | 'currency', |
||
26 | 'is_approved', |
||
27 | 'is_confirmed', |
||
28 | 'is_attended', |
||
29 | 'notes', |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | protected $casts = [ |
||
36 | 'ticket_id' => 'integer', |
||
37 | 'customer_id' => 'integer', |
||
38 | 'paid' => 'float', |
||
39 | 'currency' => 'string', |
||
40 | 'is_approved' => 'boolean', |
||
41 | 'is_confirmed' => 'boolean', |
||
42 | 'is_attended' => 'boolean', |
||
43 | 'notes' => 'string', |
||
44 | 'deleted_at' => 'datetime', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | protected $observables = [ |
||
51 | 'validating', |
||
52 | 'validated', |
||
53 | ]; |
||
54 | |||
55 | /** |
||
56 | * The default rules that the model will validate against. |
||
57 | * |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $rules = [ |
||
61 | 'ticket_id' => 'required|integer', |
||
62 | 'customer_id' => 'required|integer', |
||
63 | 'paid' => 'required|numeric', |
||
64 | 'currency' => 'required|alpha|size:3', |
||
65 | 'is_approved' => 'sometimes|boolean', |
||
66 | 'is_confirmed' => 'sometimes|boolean', |
||
67 | 'is_attended' => 'sometimes|boolean', |
||
68 | 'notes' => 'nullable|string|max:10000', |
||
69 | ]; |
||
70 | |||
71 | /** |
||
72 | * Whether the model should throw a |
||
73 | * ValidationException if it fails validation. |
||
74 | * |
||
75 | * @var bool |
||
76 | */ |
||
77 | protected $throwValidationExceptions = true; |
||
78 | |||
79 | /** |
||
80 | * Create a new Eloquent model instance. |
||
81 | * |
||
82 | * @param array $attributes |
||
83 | */ |
||
84 | public function __construct(array $attributes = []) |
||
90 | |||
91 | /** |
||
92 | * Get the active resources. |
||
93 | * |
||
94 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
95 | * |
||
96 | * @return \Illuminate\Database\Eloquent\Builder |
||
97 | */ |
||
98 | public function scopeActive(Builder $builder): Builder |
||
102 | |||
103 | /** |
||
104 | * Get the inactive resources. |
||
105 | * |
||
106 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
107 | * |
||
108 | * @return \Illuminate\Database\Eloquent\Builder |
||
109 | */ |
||
110 | public function scopeInactive(Builder $builder): Builder |
||
114 | |||
115 | /** |
||
116 | * Get the options for generating the slug. |
||
117 | * |
||
118 | * @return \Spatie\Sluggable\SlugOptions |
||
119 | */ |
||
120 | public function getSlugOptions(): SlugOptions |
||
127 | |||
128 | /** |
||
129 | * Activate the resource. |
||
130 | * |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function activate() |
||
139 | |||
140 | /** |
||
141 | * Deactivate the resource. |
||
142 | * |
||
143 | * @return $this |
||
144 | */ |
||
145 | public function deactivate() |
||
151 | } |
||
152 |