84 lines
1.8 KiB
PHP
84 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Str;
|
|
|
|
/**
|
|
* Class VideoRender
|
|
*
|
|
* @property int $id
|
|
* @property uuid $uuid
|
|
* @property string|null $external_id
|
|
* @property int|null $video_id
|
|
* @property int|null $user_id
|
|
* @property string $payload
|
|
* @property string $status
|
|
* @property Carbon|null $processing_started_at
|
|
* @property Carbon|null $processing_finished_at
|
|
* @property uuid|null $completed_video_uuid
|
|
* @property string|null $completed_video_full_url
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property Video|null $video
|
|
* @property User|null $user
|
|
*/
|
|
class VideoRender extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'video_renders';
|
|
|
|
protected $casts = [
|
|
'video_id' => 'int',
|
|
'user_id' => 'int',
|
|
'processing_started_at' => 'datetime',
|
|
'processing_finished_at' => 'datetime',
|
|
'payload' => 'object',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'uuid',
|
|
'external_id',
|
|
'video_id',
|
|
'user_id',
|
|
'payload',
|
|
'status',
|
|
'processing_started_at',
|
|
'processing_finished_at',
|
|
'completed_video_uuid',
|
|
'completed_video_full_url',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'id',
|
|
];
|
|
|
|
public function video()
|
|
{
|
|
return $this->belongsTo(Video::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* The "booted" method of the model.
|
|
*/
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(function ($model) {
|
|
$model->uuid = $model->uuid ?? (string) Str::uuid();
|
|
});
|
|
}
|
|
}
|