inital commit
This commit is contained in:
76
app/Models/RoadTechnicalBuilding.php
Normal file
76
app/Models/RoadTechnicalBuilding.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadTechnicalBuilding extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
// 'province_id',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
protected $fillable = [
|
||||
'axis_type_fa',
|
||||
'submited_at_fa',
|
||||
'last_updated_at_fa',
|
||||
'city_1_fa',
|
||||
'city_2_fa',
|
||||
'city_3_fa',
|
||||
'project_status_fa',
|
||||
'province_fa',
|
||||
'rate',
|
||||
'rate_desc'
|
||||
];
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'cities_id' => 'array',
|
||||
'project_distance' => 'array',
|
||||
'project_distance_update' => 'array',
|
||||
'start_latlng' => 'array',
|
||||
'end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the project's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
|
||||
public function projectHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadTechnicalBuildingHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadTechnicalBuildingHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user