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 | 'notes', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | protected $casts = [ |
||
33 | 'ticket_id' => 'integer', |
||
34 | 'customer_id' => 'integer', |
||
35 | 'paid' => 'float', |
||
36 | 'currency' => 'string', |
||
37 | 'notes' => 'string', |
||
38 | 'deleted_at' => 'datetime', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | protected $observables = [ |
||
45 | 'validating', |
||
46 | 'validated', |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * The default rules that the model will validate against. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $rules = [ |
||
55 | 'ticket_id' => 'required|integer', |
||
56 | 'customer_id' => 'required|integer', |
||
57 | 'paid' => 'required|numeric', |
||
58 | 'currency' => 'required|alpha|size:3', |
||
59 | 'notes' => 'nullable|string|max:10000', |
||
60 | ]; |
||
61 | |||
62 | /** |
||
63 | * Whether the model should throw a |
||
64 | * ValidationException if it fails validation. |
||
65 | * |
||
66 | * @var bool |
||
67 | */ |
||
68 | protected $throwValidationExceptions = true; |
||
69 | |||
70 | /** |
||
71 | * Create a new Eloquent model instance. |
||
72 | * |
||
73 | * @param array $attributes |
||
74 | */ |
||
75 | public function __construct(array $attributes = []) |
||
81 | |||
82 | /** |
||
83 | * Get the active resources. |
||
84 | * |
||
85 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
86 | * |
||
87 | * @return \Illuminate\Database\Eloquent\Builder |
||
88 | */ |
||
89 | public function scopeActive(Builder $builder): Builder |
||
93 | |||
94 | /** |
||
95 | * Get the inactive resources. |
||
96 | * |
||
97 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
98 | * |
||
99 | * @return \Illuminate\Database\Eloquent\Builder |
||
100 | */ |
||
101 | public function scopeInactive(Builder $builder): Builder |
||
105 | |||
106 | /** |
||
107 | * Get the options for generating the slug. |
||
108 | * |
||
109 | * @return \Spatie\Sluggable\SlugOptions |
||
110 | */ |
||
111 | public function getSlugOptions(): SlugOptions |
||
118 | |||
119 | /** |
||
120 | * Activate the resource. |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function makeActive() |
||
130 | |||
131 | /** |
||
132 | * Deactivate the resource. |
||
133 | * |
||
134 | * @return $this |
||
135 | */ |
||
136 | public function makeInactive() |
||
142 | } |
||
143 |