inital commit
This commit is contained in:
77
app/Models/City.php
Normal file
77
app/Models/City.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class City extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'name_en',
|
||||
'feature_id',
|
||||
'province_feature_id',
|
||||
'center_lat',
|
||||
'center_long',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the city.
|
||||
*/
|
||||
public function roadConstructionProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadConstructionProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the city.
|
||||
*/
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadItemsProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the city.
|
||||
*/
|
||||
public function roadPatrolProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadPatrolProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadMaintenanceProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadMaintenanceProject');
|
||||
}
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadConstructionRural()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadConstructionRural');
|
||||
}
|
||||
|
||||
public function edarateShahri()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\EdarateShahri', 'edarate_shahri_be_city')->withPivot('is_primary','id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user