1 | <?php |
||
55 | class PlanFeature extends Model implements PlanFeatureContract, Sortable |
||
56 | { |
||
57 | use HasSlug; |
||
58 | use BelongsToPlan; |
||
59 | use SortableTrait; |
||
60 | use HasTranslations; |
||
61 | use ValidatingTrait; |
||
62 | use CacheableEloquent; |
||
63 | |||
64 | /** |
||
65 | * {@inheritdoc} |
||
66 | */ |
||
67 | protected $fillable = [ |
||
68 | 'plan_id', |
||
69 | 'slug', |
||
70 | 'name', |
||
71 | 'description', |
||
72 | 'value', |
||
73 | 'resettable_period', |
||
74 | 'resettable_interval', |
||
75 | 'sort_order', |
||
76 | ]; |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | protected $casts = [ |
||
82 | 'plan_id' => 'integer', |
||
83 | 'slug' => 'string', |
||
84 | 'value' => 'string', |
||
85 | 'resettable_period' => 'integer', |
||
86 | 'resettable_interval' => 'string', |
||
87 | 'sort_order' => 'integer', |
||
88 | 'deleted_at' => 'datetime', |
||
89 | ]; |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | protected $observables = [ |
||
95 | 'validating', |
||
96 | 'validated', |
||
97 | ]; |
||
98 | |||
99 | /** |
||
100 | * The attributes that are translatable. |
||
101 | * |
||
102 | * @var array |
||
103 | */ |
||
104 | public $translatable = [ |
||
105 | 'name', |
||
106 | 'description', |
||
107 | ]; |
||
108 | |||
109 | /** |
||
110 | * The sortable settings. |
||
111 | * |
||
112 | * @var array |
||
113 | */ |
||
114 | public $sortable = [ |
||
115 | 'order_column_name' => 'sort_order', |
||
116 | ]; |
||
117 | |||
118 | /** |
||
119 | * The default rules that the model will validate against. |
||
120 | * |
||
121 | * @var array |
||
122 | */ |
||
123 | protected $rules = []; |
||
124 | |||
125 | /** |
||
126 | * Whether the model should throw a |
||
127 | * ValidationException if it fails validation. |
||
128 | * |
||
129 | * @var bool |
||
130 | */ |
||
131 | protected $throwValidationExceptions = true; |
||
132 | |||
133 | /** |
||
134 | * Create a new Eloquent model instance. |
||
135 | * |
||
136 | * @param array $attributes |
||
137 | */ |
||
138 | public function __construct(array $attributes = []) |
||
154 | |||
155 | /** |
||
156 | * Get the options for generating the slug. |
||
157 | * |
||
158 | * @return \Spatie\Sluggable\SlugOptions |
||
159 | */ |
||
160 | public function getSlugOptions(): SlugOptions |
||
167 | |||
168 | /** |
||
169 | * The plan feature may have many subscription usage. |
||
170 | * |
||
171 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
172 | */ |
||
173 | public function usage(): HasMany |
||
177 | |||
178 | /** |
||
179 | * Get feature's reset date. |
||
180 | * |
||
181 | * @param string $dateFrom |
||
182 | * |
||
183 | * @return \Carbon\Carbon |
||
184 | */ |
||
185 | public function getResetDate(Carbon $dateFrom): Carbon |
||
191 | } |
||
192 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.