52 lines
1 KiB
PHP
52 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Carbon\Carbon;
|
|
|
|
class ArcadiaLink extends Model
|
|
{
|
|
/**
|
|
* *The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'arcadia_link';
|
|
|
|
// * GETTERS
|
|
|
|
/**
|
|
* Get dateF attribute
|
|
*
|
|
* @return string
|
|
* @phpcs:disable Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps
|
|
*/
|
|
public function getDateFAttribute()
|
|
{
|
|
return Carbon::createFromFormat('Y-m-d H:i:s', $this->created_at)->format('d/m/Y H:i:s');
|
|
}
|
|
|
|
/**
|
|
* Get mediaUuid attribute
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getMediaUuidAttribute()
|
|
{
|
|
$m = Media::withTrashed()->find($this->media_id);
|
|
return $m->uid;
|
|
}
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* BelongsTo media relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function media()
|
|
{
|
|
return $this->belongsTo(Media::class);
|
|
}
|
|
}
|