28 lines
640 B
PHP
28 lines
640 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BackgroundSound extends Model
|
|
{
|
|
protected $fillable = ['name', 'sound_path', 'image_path', 'order', 'is_active'];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'order' => 'integer',
|
|
];
|
|
|
|
protected $appends = ['sound_url', 'image_url'];
|
|
|
|
public function getSoundUrlAttribute(): ?string
|
|
{
|
|
return $this->sound_path ? asset('storage/' . $this->sound_path) : null;
|
|
}
|
|
|
|
public function getImageUrlAttribute(): ?string
|
|
{
|
|
return $this->image_path ? asset('storage/' . $this->image_path) : null;
|
|
}
|
|
}
|