60 lines
1.3 KiB
PHP
60 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DangerPoint extends Model
|
|
{
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'accident_cause' => 'array',
|
|
'accident_severity' => 'array'
|
|
];
|
|
protected $fillable = [
|
|
'province_fa',
|
|
'axis_type_fa',
|
|
'geometric_desc_fa',
|
|
'accident_result_de',
|
|
'accident_result_in',
|
|
'accident_zi',
|
|
'accident_p',
|
|
'accident_avg_weighted_average',
|
|
'weighted_average',
|
|
'accident_sigma',
|
|
'accident_sigma_2',
|
|
'standard_deviation'
|
|
];
|
|
/**
|
|
* Get all of the point's files.
|
|
*/
|
|
public function files()
|
|
{
|
|
return $this->morphMany('App\Models\PointFile', 'point_fileable');
|
|
}
|
|
|
|
public function dangerPointHistories()
|
|
{
|
|
return $this->hasMany('App\Models\DangerPointHistory', 'point_id');
|
|
}
|
|
|
|
public function dangerPointAccidents()
|
|
{
|
|
return $this->hasMany('App\Models\DangerPointAccident', 'point_id');
|
|
}
|
|
|
|
public function province()
|
|
{
|
|
return $this->belongsTo('App\Models\Province');
|
|
}
|
|
|
|
public function city()
|
|
{
|
|
return $this->belongsTo('App\Models\City');
|
|
}
|
|
}
|