VideoTemp.php
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?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', 'text_h'], 'topMiddle' => ['(w-text_w)/2', 'text_h'], 'topRight' => ['w-text_w', 'text_h'],
'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*2'], 'botMiddle' => ['(w-text_w)/2', 'h-text_h*2'], 'botRight' => ['w-text_w', 'h-text_h*2'],
];
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', 'text_color', 'text_bg_color', 'text_bg_box','opacity','fix_bounds']);
}
}