48 lines
975 B
PHP
48 lines
975 B
PHP
<?php
|
|
|
|
namespace Modules\Gallery\app\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Modules\Gallery\Database\factories\GalleryFactory;
|
|
|
|
class Gallery extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected $fillable = [
|
|
'uuid',
|
|
'gallery_category_id',
|
|
'detail',
|
|
'image',
|
|
'image_path',
|
|
'video_link',
|
|
'status',
|
|
];
|
|
|
|
protected static function newFactory(): GalleryFactory
|
|
{
|
|
//return GalleryFactory::new();
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public function getFullImageAttribute()
|
|
{
|
|
$result = null;
|
|
if($this->image_path) {
|
|
$result = asset('storage/uploads/' . $this->image_path);
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
public function galleryCategory()
|
|
{
|
|
return $this->belongsTo(GalleryCategory::class, 'gallery_category_id');
|
|
}
|
|
}
|