38 lines
754 B
PHP
38 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DisplayVideo extends Model
|
|
{
|
|
protected $fillable = [
|
|
'filename',
|
|
'title',
|
|
'position',
|
|
'sort_order',
|
|
'is_active',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_active' => 'boolean',
|
|
'position' => 'integer',
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* Scope für aktive Videos in sortierter Reihenfolge
|
|
*/
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('is_active', true)->orderBy('sort_order');
|
|
}
|
|
|
|
/**
|
|
* Gibt den vollständigen Pfad zum Video zurück
|
|
*/
|
|
public function getFullPathAttribute(): string
|
|
{
|
|
return "assets/{$this->filename}";
|
|
}
|
|
}
|