Files
approagency/app/Models/Promotion.php
T
2025-11-25 16:14:38 +03:30

32 lines
698 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
class Promotion extends Model
{
protected $fillable = [
'type', 'title', 'subtitle', 'image', 'action_text',
'url_myket', 'url_bazzar', 'url_google_play', 'url_site',
'is_active', 'priority', 'start_at', 'end_at'
];
protected $casts = [
'is_active' => 'boolean',
'start_at' => 'datetime',
'end_at' => 'datetime'
];
protected $appends = ['image_url'];
public function getImageUrlAttribute()
{
if ($this->image) {
return Storage::disk('public')->url($this->image);
}
return null;
}
}