Your IP : 216.73.216.79


Current Path : /var/www/html/dev/reddsis-dev/app/Models/Backend/
Upload File :
Current File : /var/www/html/dev/reddsis-dev/app/Models/Backend/ContentPhotoGallery.php

<?php

namespace App\Models\Backend;

use App\Models\Backend\ContentPhotoGalleryTranslation;
use App\Models\Backend\ContentPhotoList;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[Table('content_photo_gallery', key: 'gallery_id')]
#[Fillable([
    'gallery_date',
    'gallery_location',
    'gallery_status',
    'gallery_portal',
    'gallery_thumbnail',
    'gallery_cat',
    'gallery_code',
    'gallery_sort',
    'created_by',
    'updated_by',
])]
class ContentPhotoGallery extends Model
{
    use HasFactory;

    public function translations()
    {
        return $this->hasMany(
            ContentPhotoGalleryTranslation::class,
            'gallery_translation_parent_id',
            'gallery_id'
        );
    }

    public function photoLists()
    {
        return $this->hasMany(ContentPhotoList::class, 'photo_gallery_id', 'gallery_id');
    }

    protected function casts(): array
    {
        return [
            'gallery_sort' => 'integer',
            'created_at' => 'datetime',
            'updated_at' => 'datetime',
        ];
    }
}