mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 09:01:42 -04:00
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Entities;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class Upload extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'studio_plus_uploads';
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'title',
|
|
'description',
|
|
'video_url',
|
|
'visibility',
|
|
'filename'
|
|
];
|
|
|
|
public const VISIBILITY_TYPE_DRAFT = 'draft';
|
|
public const VISIBILITY_TYPE_PRIVATE = 'private';
|
|
public const VISIBILITY_TYPE_PUBLIC = 'public';
|
|
|
|
public static function visibilityTypes()
|
|
{
|
|
return [
|
|
self::VISIBILITY_TYPE_DRAFT => self::VISIBILITY_TYPE_DRAFT,
|
|
self::VISIBILITY_TYPE_PRIVATE => self::VISIBILITY_TYPE_PRIVATE,
|
|
self::VISIBILITY_TYPE_PUBLIC => self::VISIBILITY_TYPE_PUBLIC,
|
|
];
|
|
}
|
|
|
|
public function thumbnails()
|
|
{
|
|
return $this->hasMany(UploadThumbnail::class, 'studio_plus_upload_id')->latest();
|
|
}
|
|
|
|
public function getVideoUrlAttribute($value)
|
|
{
|
|
return url($value);
|
|
}
|
|
}
|