1 | <?php |
||
15 | abstract class Ticketable extends Model |
||
16 | { |
||
17 | use HasSlug; |
||
18 | use TicketableTrait; |
||
19 | use HasTranslations; |
||
20 | use ValidatingTrait; |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | protected $fillable = [ |
||
26 | 'slug', |
||
27 | 'name', |
||
28 | 'description', |
||
29 | 'is_public', |
||
30 | 'starts_at', |
||
31 | 'ends_at', |
||
32 | 'timezone', |
||
33 | 'location', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | protected $casts = [ |
||
40 | 'slug' => 'string', |
||
41 | 'name' => 'string', |
||
42 | 'description' => 'string', |
||
43 | 'is_public' => 'boolean', |
||
44 | 'starts_at' => 'datetime', |
||
45 | 'ends_at' => 'datetime', |
||
46 | 'timezone' => 'string', |
||
47 | 'location' => 'string', |
||
48 | 'deleted_at' => 'datetime', |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | protected $observables = [ |
||
55 | 'validating', |
||
56 | 'validated', |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public $translatable = [ |
||
63 | 'name', |
||
64 | 'description', |
||
65 | ]; |
||
66 | |||
67 | /** |
||
68 | * The default rules that the model will validate against. |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $rules = []; |
||
73 | |||
74 | /** |
||
75 | * Whether the model should throw a |
||
76 | * ValidationException if it fails validation. |
||
77 | * |
||
78 | * @var bool |
||
79 | */ |
||
80 | protected $throwValidationExceptions = true; |
||
81 | |||
82 | /** |
||
83 | * Create a new Eloquent model instance. |
||
84 | * |
||
85 | * @param array $attributes |
||
86 | */ |
||
87 | public function __construct(array $attributes = []) |
||
102 | |||
103 | /** |
||
104 | * Get the public resources. |
||
105 | * |
||
106 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
107 | * |
||
108 | * @return \Illuminate\Database\Eloquent\Builder |
||
109 | */ |
||
110 | public function scopePublic(Builder $builder): Builder |
||
114 | |||
115 | /** |
||
116 | * Get the private resources. |
||
117 | * |
||
118 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
119 | * |
||
120 | * @return \Illuminate\Database\Eloquent\Builder |
||
121 | */ |
||
122 | public function scopePrivate(Builder $builder): Builder |
||
126 | |||
127 | /** |
||
128 | * Get the options for generating the slug. |
||
129 | * |
||
130 | * @return \Spatie\Sluggable\SlugOptions |
||
131 | */ |
||
132 | public function getSlugOptions(): SlugOptions |
||
139 | |||
140 | /** |
||
141 | * Activate the resource. |
||
142 | * |
||
143 | * @return $this |
||
144 | */ |
||
145 | public function makePublic() |
||
151 | |||
152 | /** |
||
153 | * Deactivate the resource. |
||
154 | * |
||
155 | * @return $this |
||
156 | */ |
||
157 | public function makePrivate() |
||
163 | } |
||
164 |