VideoTemp.php
1.49 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
40
41
42
43
44
45
<?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+68'], 'topMiddle' => ['(w-text_w)/2', 'text_h+68'], 'topRight' => ['w-text_w', 'text_h+68'],
'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-68'], 'botMiddle' => ['(w-text_w)/2', 'h-text_h*2-68'], 'botRight' => ['w-text_w', 'h-text_h*2-68'],
];
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', 'draw',
'fade_time', 'text_bg_color', 'text_bg_box', 'opacity']);
}
public function admin_make_video()
{
return $this->belongsTo(AdminMakeVideo::class,'temp_id');
}
}