mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 09:01:42 -04:00
50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Entities;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ContentWatermark extends Model
|
|
{
|
|
protected $table = 'studio_content_watermarks';
|
|
protected $fillable = [
|
|
'content_type_id',
|
|
'content_variant_id',
|
|
'type',
|
|
'watermark',
|
|
'in_time',
|
|
'out_time',
|
|
'in_duration',
|
|
'out_duration',
|
|
'left',
|
|
'top',
|
|
'bottom',
|
|
'right',
|
|
'position',
|
|
'active'
|
|
];
|
|
|
|
protected $appends = [
|
|
'watermark_url'
|
|
];
|
|
|
|
public function contentType()
|
|
{
|
|
return $this->hasOne(ContentType::class, 'id', 'content_type_id');
|
|
}
|
|
|
|
public function contentVariant()
|
|
{
|
|
return $this->hasOne(ContentVariant::class, 'id', 'content_variant_id');
|
|
}
|
|
|
|
public function getWatermarkUrlAttribute()
|
|
{
|
|
if ($this->type == 'image') {
|
|
return asset("storage/$this->watermark");
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|