inital commit
This commit is contained in:
59
app/Models/DangerPoint.php
Normal file
59
app/Models/DangerPoint.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user