51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class Project extends Model
|
||
|
{
|
||
|
use HasFactory;
|
||
|
|
||
|
protected $fillable=['region_id','apartments','floors','card_image','background_image','logo','status','3d_tour_one','3d_tour_two','yard_image','hall_image','location','slug'];
|
||
|
|
||
|
protected $attributes=['status'=>1];
|
||
|
|
||
|
public function translations()
|
||
|
{
|
||
|
return $this->hasMany(AdvantageTranslation::class);
|
||
|
}
|
||
|
|
||
|
public function region()
|
||
|
{
|
||
|
return $this->belongsTo(Region::class);
|
||
|
}
|
||
|
|
||
|
public function flats()
|
||
|
{
|
||
|
return $this->hasMany(Flat::class);
|
||
|
}
|
||
|
|
||
|
public function events()
|
||
|
{
|
||
|
return $this->hasMany(Event::class);
|
||
|
}
|
||
|
|
||
|
public function roomTypes()
|
||
|
{
|
||
|
return $this->hasMany(RoomType::class);
|
||
|
}
|
||
|
|
||
|
public function images()
|
||
|
{
|
||
|
return $this->hasMany(ProjectImage::class);
|
||
|
}
|
||
|
|
||
|
public function advantages()
|
||
|
{
|
||
|
return $this->belongsToMany(ProjectAdvantage::class, 'project_advantages_project');
|
||
|
}
|
||
|
}
|