Files
2025-08-17 16:23:14 +05:45

74 lines
1.5 KiB
PHP

<?php
namespace Modules\Destination\app\Models;
use Illuminate\Database\Eloquent\Model;
use Modules\Activity\app\Models\Activity;
use Modules\CountryList\app\Models\Country;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Destination\Database\factories\DestinationFactory;
class Destination extends Model
{
use SoftDeletes;
// use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'uuid',
'country_id',
'title',
'rating',
'ordering',
'image',
'image_path ',
'status ',
];
public function country(){
return $this->belongsTo(Country::class);
}
public function activities()
{
return $this->belongsToMany(Activity::class,'activity_destination');
}
// protected static function newFactory(): DestinationFactory
// {
// //return DestinationFactory::new();
// }
/**
*
*/
public function getFullImageAttribute()
{
$result = null;
if($this->image_path) {
$result = asset('storage/uploads/' . $this->image_path);
}
return $result;
}
/**
*
*/
public function getCountryNameAttribute()
{
$result = null;
if($this->country_id) {
$result = optional($this->country)->name;
}
return $result;
}
}