VideoTemp.php 1.15 KB
<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class VideoTemp extends Model
{
	use HasDateTimeFormatter;

	const POSITION_OPTIONS = [
        'topLeft'=>'上左','topMiddle'=>'上中','topRight'=>'上右',
        'midLeft'=>'中左','midMiddle'=>'中中','midRight'=>'中右',
        'botLeft'=>'下左','botMiddle'=>'下中','botRight'=>'下右',
    ];

    const POSITION_FFMPEG = [
        'topLeft' => [0, 0], 'topMiddle' => ['(w-text_w)/2', 0], 'topRight' => ['w-text_w', 0],
        'midLeft' => [0, '(h-text_h)/2'], 'midMiddle' => ['(w-text_w)/2', '(h-text_h)/2'], 'midRight' => ['w-text_w', '(h-text_h)/2'],
        'botLeft' => [0, 'h-text_h'], 'botMiddle' => ['(w-text_w)/2', 'h-text_h'], 'botRight' => ['w-text_w', 'h-text_h'],
    ];

    protected $table = 'video_temp';

    protected $guarded = [''];

    public function components()
    {
        return $this->hasMany('App\Models\Component','temp_id');
    }

    public function componentsTable()
    {
        return $this->hasMany('App\Models\Component','temp_id')->select(['id','temp_id','name','position','font_size']);
    }
}