38 lines
716 B
PHP
38 lines
716 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Video extends Model
|
|
{
|
|
protected $fillable = [
|
|
'title',
|
|
'description',
|
|
'filename',
|
|
'path',
|
|
'thumbnail',
|
|
'duration',
|
|
'size',
|
|
'status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'duration' => 'integer',
|
|
'size' => 'integer',
|
|
];
|
|
|
|
public function getUrlAttribute()
|
|
{
|
|
return asset('storage/videos/' . $this->filename);
|
|
}
|
|
|
|
public function getThumbnailUrlAttribute()
|
|
{
|
|
if ($this->thumbnail) {
|
|
return asset('storage/thumbnails/' . $this->thumbnail);
|
|
}
|
|
return asset('images/video-placeholder.jpg');
|
|
}
|
|
}
|