|
4 | 4 |
|
5 | 5 | namespace Laravelcm\Subscriptions\Models;
|
6 | 6 |
|
| 7 | +use Illuminate\Database\Eloquent\Factories\HasFactory; |
7 | 8 | use Illuminate\Database\Eloquent\Model;
|
8 |
| -use Illuminate\Database\Eloquent\SoftDeletes; |
9 | 9 | use Illuminate\Database\Eloquent\Relations\HasMany;
|
10 |
| -use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 10 | +use Illuminate\Database\Eloquent\SoftDeletes; |
11 | 11 | use Laravelcm\Subscriptions\Traits\HasSlug;
|
12 | 12 | use Laravelcm\Subscriptions\Traits\HasTranslations;
|
| 13 | +use Spatie\EloquentSortable\Sortable; |
13 | 14 | use Spatie\EloquentSortable\SortableTrait;
|
14 | 15 | use Spatie\Sluggable\SlugOptions;
|
15 |
| -use Spatie\EloquentSortable\Sortable; |
16 | 16 |
|
17 | 17 | /**
|
18 |
| - * Laravelcm\Subscriptions\Models\Plan. |
19 |
| - * |
20 |
| - * @property int $id |
| 18 | + * @property-read int|string $id |
21 | 19 | * @property string $slug
|
22 | 20 | * @property array $name
|
23 | 21 | * @property array $description
|
@@ -96,22 +94,9 @@ class Plan extends Model implements Sortable
|
96 | 94 | ];
|
97 | 95 |
|
98 | 96 | protected $casts = [
|
99 |
| - 'slug' => 'string', |
100 | 97 | 'is_active' => 'boolean',
|
101 | 98 | 'price' => 'float',
|
102 | 99 | 'signup_fee' => 'float',
|
103 |
| - 'currency' => 'string', |
104 |
| - 'trial_period' => 'integer', |
105 |
| - 'trial_interval' => 'string', |
106 |
| - 'invoice_period' => 'integer', |
107 |
| - 'invoice_interval' => 'string', |
108 |
| - 'grace_period' => 'integer', |
109 |
| - 'grace_interval' => 'string', |
110 |
| - 'prorate_day' => 'integer', |
111 |
| - 'prorate_period' => 'integer', |
112 |
| - 'prorate_extend_due' => 'integer', |
113 |
| - 'active_subscribers_limit' => 'integer', |
114 |
| - 'sort_order' => 'integer', |
115 | 100 | 'deleted_at' => 'datetime',
|
116 | 101 | ];
|
117 | 102 |
|
@@ -149,7 +134,8 @@ public function getSlugOptions(): SlugOptions
|
149 | 134 | return SlugOptions::create()
|
150 | 135 | ->doNotGenerateSlugsOnUpdate()
|
151 | 136 | ->generateSlugsFrom('name')
|
152 |
| - ->saveSlugsTo('slug'); |
| 137 | + ->saveSlugsTo('slug') |
| 138 | + ->allowDuplicateSlugs(); |
153 | 139 | }
|
154 | 140 |
|
155 | 141 | public function features(): HasMany
|
|
0 commit comments