implemented event package addons with filament resource, event-admin purchase path and notifications, showing up in purchase history
This commit is contained in:
44
app/Models/PackageAddon.php
Normal file
44
app/Models/PackageAddon.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PackageAddon extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'label',
|
||||
'price_id',
|
||||
'extra_photos',
|
||||
'extra_guests',
|
||||
'extra_gallery_days',
|
||||
'active',
|
||||
'sort',
|
||||
'metadata',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
'metadata' => 'array',
|
||||
'extra_photos' => 'integer',
|
||||
'extra_guests' => 'integer',
|
||||
'extra_gallery_days' => 'integer',
|
||||
'sort' => 'integer',
|
||||
];
|
||||
|
||||
protected function increments(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => [
|
||||
'extra_photos' => (int) ($this->extra_photos ?? 0),
|
||||
'extra_guests' => (int) ($this->extra_guests ?? 0),
|
||||
'extra_gallery_days' => (int) ($this->extra_gallery_days ?? 0),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user