inital commit
This commit is contained in:
49
app/Models/AbrarPlanProject.php
Normal file
49
app/Models/AbrarPlanProject.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AbrarPlanProject extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'province_id',
|
||||
'city_id',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'project_type' => 'array',
|
||||
'project_start_latlng' => 'array',
|
||||
'project_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
/**
|
||||
* 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\AbrarPlanProjectHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
}
|
||||
42
app/Models/AbrarPlanProjectHistory.php
Normal file
42
app/Models/AbrarPlanProjectHistory.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AbrarPlanProjectHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_type',
|
||||
'previous_status',
|
||||
'previous_status_progress',
|
||||
'previous_status_description',
|
||||
'previous_status_date',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_length',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_type' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\AbrarPlanProject');
|
||||
}
|
||||
}
|
||||
89
app/Models/Accident.php
Normal file
89
app/Models/Accident.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\ReceiptReportAble;
|
||||
|
||||
class Accident extends Model
|
||||
{
|
||||
use ReceiptReportAble;
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function ($model) {
|
||||
});
|
||||
|
||||
self::created(function ($model) {
|
||||
// auth()->user()->addActivityComplete(1118);
|
||||
});
|
||||
|
||||
self::updating(function ($model) {
|
||||
});
|
||||
|
||||
self::updated(function ($model) {
|
||||
});
|
||||
|
||||
self::deleting(function ($model) {
|
||||
// auth()->user()->addActivityComplete(1120,$model);
|
||||
});
|
||||
|
||||
self::deleted(function ($model) {
|
||||
});
|
||||
}
|
||||
|
||||
public function damages()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Damage')->withPivot('unit', 'amount', 'value');
|
||||
}
|
||||
|
||||
|
||||
public function withoutAction()
|
||||
{
|
||||
if ($this->status == 0) {
|
||||
$this->status_fa = "بدون اقدام";
|
||||
}
|
||||
}
|
||||
|
||||
public function sendToInsurance()
|
||||
{
|
||||
if ($this->status == 0) {
|
||||
$this->status_fa = "صدور نامه بیمه و کارشناسی داغی";
|
||||
$this->status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function receiveInsuranceAndDaqiBill()
|
||||
{
|
||||
if ($this->status == 1) {
|
||||
$this->status_fa = "فیش ها ثبت شده است.";
|
||||
$this->status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public function invoiceBill()
|
||||
{
|
||||
if ($this->status == 2) {
|
||||
$this->status_fa = "فاکتور صادر شده است.";
|
||||
$this->status = 3;
|
||||
}
|
||||
}
|
||||
|
||||
public function payBill()
|
||||
{
|
||||
if ($this->status == 3) {
|
||||
$this->status_fa = "فاکتور پرداخت شده است";
|
||||
$this->status = 4;
|
||||
}
|
||||
}
|
||||
|
||||
public function documentRelease()
|
||||
{
|
||||
if ($this->status == 4) {
|
||||
$this->status_fa = "نامه پلیس راه صادر شده است (اتمام فرایند)";
|
||||
$this->status = 5;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Models/Accident251Point.php
Normal file
54
app/Models/Accident251Point.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Accident251Point extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'accident_251_points';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'lat',
|
||||
'lng',
|
||||
'province',
|
||||
'axis_name',
|
||||
'axis_start',
|
||||
'axis_end',
|
||||
'native_name',
|
||||
'operation',
|
||||
'target',
|
||||
'cost',
|
||||
'progress',
|
||||
'end_date',
|
||||
'actions'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get all of the point's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\PointFile', 'point_fileable');
|
||||
}
|
||||
|
||||
public function accident251PointsHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Accident251PointsHistory', 'point_id');
|
||||
}
|
||||
|
||||
public function accidentPoint()
|
||||
{
|
||||
return $this->belongsTo('App\Models\AccidentPoint');
|
||||
}
|
||||
}
|
||||
36
app/Models/Accident251PointsHistory.php
Normal file
36
app/Models/Accident251PointsHistory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Accident251PointsHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'accident_251_points_histories';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_lat',
|
||||
'previous_lng',
|
||||
'previous_cost',
|
||||
'previous_progress',
|
||||
'previous_end_date',
|
||||
'previous_actions',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
public function accident251Point()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Accident251Point');
|
||||
}
|
||||
}
|
||||
26
app/Models/AccidentPoint.php
Normal file
26
app/Models/AccidentPoint.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AccidentPoint extends Model
|
||||
{
|
||||
/**
|
||||
* Get all of the point's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\PointFile', 'point_fileable');
|
||||
}
|
||||
|
||||
public function accidentPointHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\AccidentPointHistory', 'point_id');
|
||||
}
|
||||
|
||||
public function accident251Point()
|
||||
{
|
||||
return $this->hasOne('App\Models\Accident251Point');
|
||||
}
|
||||
}
|
||||
31
app/Models/AccidentPointHistory.php
Normal file
31
app/Models/AccidentPointHistory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AccidentPointHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_lat',
|
||||
'previous_lng',
|
||||
'previous_operation',
|
||||
'previous_target',
|
||||
'previous_cost',
|
||||
'previous_progress',
|
||||
'previous_end_date',
|
||||
'previous_actions',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
public function accidentPoint()
|
||||
{
|
||||
return $this->belongsTo('App\Models\AccidentPoint');
|
||||
}
|
||||
}
|
||||
23
app/Models/BBJahesh.php
Normal file
23
app/Models/BBJahesh.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BBJahesh extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'province_fa',
|
||||
'province_id',
|
||||
'project_type',
|
||||
'project_type_fa',
|
||||
'plan_id',
|
||||
'plan_fa',
|
||||
'project_count_all',
|
||||
'project_count_done',
|
||||
'project_progress',
|
||||
'unit',
|
||||
'lat_updated_at_fa'
|
||||
|
||||
];
|
||||
}
|
||||
10
app/Models/BBOpening.php
Normal file
10
app/Models/BBOpening.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BBOpening extends Model
|
||||
{
|
||||
|
||||
}
|
||||
10
app/Models/BBPriority.php
Normal file
10
app/Models/BBPriority.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BBPriority extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
35
app/Models/BBProjectIndicators.php
Normal file
35
app/Models/BBProjectIndicators.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BBProjectIndicators extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'project_province_fa',
|
||||
'project_province_id',
|
||||
'project_plan_id',
|
||||
'project_plan_id',
|
||||
'project_office_fa',
|
||||
'project_office_id',
|
||||
'province_fa',
|
||||
'province_id',
|
||||
'city_fa',
|
||||
'city_id',
|
||||
'project_indicator_fa',
|
||||
'project_indicator_id',
|
||||
'project_year',
|
||||
'project_name',
|
||||
'project_related',
|
||||
'project_axis',
|
||||
'project_accept_value',
|
||||
'project_accept_done',
|
||||
'project_progress',
|
||||
'project_communicate_value',
|
||||
'project_allocate_value',
|
||||
'project_unique_id',
|
||||
'unit',
|
||||
|
||||
];
|
||||
}
|
||||
10
app/Models/BiBama.php
Normal file
10
app/Models/BiBama.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BiBama extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
97
app/Models/CMMS_Form.php
Normal file
97
app/Models/CMMS_Form.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CMMS_Form extends Model
|
||||
{
|
||||
protected $table = 'cmms_forms';
|
||||
|
||||
protected $fillable = [
|
||||
'dedicated_number',
|
||||
'chassis_number',
|
||||
'province_id',
|
||||
'gps_code',
|
||||
'province_fa',
|
||||
'operator_phone',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'device_name',
|
||||
'operator_name',
|
||||
'operator_nationalcode',
|
||||
'operator_phone',
|
||||
'form_number',
|
||||
'car_type',
|
||||
'motor',
|
||||
'motor_description',
|
||||
'motor_score',
|
||||
'power',
|
||||
'power_description',
|
||||
'power_score',
|
||||
'zirbandi',
|
||||
'zirbandi_description',
|
||||
'zirbandi_score',
|
||||
'chassis',
|
||||
'chassis_description',
|
||||
'chassis_score',
|
||||
'electrical',
|
||||
'electrical_description',
|
||||
'electrical_score',
|
||||
'safety',
|
||||
'safety_description',
|
||||
'safety_score',
|
||||
'gps',
|
||||
'gps_description',
|
||||
'gps_score',
|
||||
'color',
|
||||
'color_description',
|
||||
'color_score',
|
||||
'bucket',
|
||||
'bucket_description',
|
||||
'bucket_score',
|
||||
'hydraulic',
|
||||
'hydraulic_description',
|
||||
'hydraulic_score',
|
||||
'jolobandi',
|
||||
'jolobandi_description',
|
||||
'jolobandi_score',
|
||||
'ripper',
|
||||
'ripper_description',
|
||||
'ripper_score',
|
||||
'service_status',
|
||||
'service_description',
|
||||
'fuel_form',
|
||||
'fuel_description',
|
||||
'question1',
|
||||
'question2',
|
||||
'question3',
|
||||
'question4',
|
||||
'question5',
|
||||
'auditor_name',
|
||||
'auditor_position',
|
||||
'member1_name',
|
||||
'member1_position',
|
||||
'member2_name',
|
||||
'member2_position',
|
||||
'member3_name',
|
||||
'member3_position',
|
||||
'total_points',
|
||||
'image1',
|
||||
'image2',
|
||||
'image3',
|
||||
'file1',
|
||||
'car_type_fa',
|
||||
'created_at_fa',
|
||||
'updated_at_fa',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function cmms_form_histories()
|
||||
{
|
||||
return $this->hasOne(CMMS_Forms_histories::class, 'cmms_forms_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
40
app/Models/CMMS_Forms_histories.php
Normal file
40
app/Models/CMMS_Forms_histories.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CMMS_Forms_histories extends Model
|
||||
{
|
||||
protected $table = 'cmms_forms_histories';
|
||||
|
||||
protected $fillable = [
|
||||
'cmms_form_id',
|
||||
'user_id',
|
||||
'previous_chassis_number',
|
||||
'previous_province_id',
|
||||
'previous_province_fa',
|
||||
'previous_city_id',
|
||||
'previous_city_fa',
|
||||
'previous_gps_code',
|
||||
'previous_device_name',
|
||||
'previous_operator_name',
|
||||
'previous_operator_nationalcode',
|
||||
'previous_operator_phone',
|
||||
'previous_image1',
|
||||
'previous_image2',
|
||||
'previous_image3',
|
||||
'previous_file1',
|
||||
'previous_form_number'
|
||||
];
|
||||
|
||||
public function cmms_form()
|
||||
{
|
||||
return $this->belongsTo(CMMS_Form::class, 'cmms_form_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
16
app/Models/CMMS_Province.php
Normal file
16
app/Models/CMMS_Province.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CMMS_Province extends Model
|
||||
{
|
||||
protected $table = 'cmms_province';
|
||||
|
||||
protected $fillable = [
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'area_code',
|
||||
];
|
||||
}
|
||||
158
app/Models/Camp.php
Normal file
158
app/Models/Camp.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Camp extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1047,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1048,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1049,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'block_axis_desc',
|
||||
'active_rahdar_count',
|
||||
'active_cars_count',
|
||||
'is_open',
|
||||
'is_open_type',
|
||||
'is_open_type_fa',
|
||||
'blockage_damage_count',
|
||||
'blockage_damage_lower_6_count',
|
||||
'blockage_damage_higher_6_count',
|
||||
'blockage_damage_money',
|
||||
'blockage_length',
|
||||
'blockage_type',
|
||||
'blockage_type_fa',
|
||||
'prediction_time',
|
||||
'prediction_time_fa',
|
||||
'blockage_cause',
|
||||
'blockage_cause_fa',
|
||||
'axis_type',
|
||||
'axis_type_fa',
|
||||
'city_1_fa',
|
||||
'city_2_fa',
|
||||
'city_3_fa',
|
||||
'province_fa',
|
||||
'submited_at',
|
||||
'is_open_at'
|
||||
];
|
||||
protected $casts = [
|
||||
'cities_id' => 'array',
|
||||
'start_latlng' => 'array',
|
||||
'end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setAxisTypeFa($axis_type)
|
||||
{
|
||||
switch ($axis_type) {
|
||||
case 1:
|
||||
$axis_type_fa = 'آزادراه';
|
||||
break;
|
||||
case 2:
|
||||
$axis_type_fa = 'اصلی';
|
||||
break;
|
||||
case 3:
|
||||
$axis_type_fa = 'فرعی';
|
||||
break;
|
||||
case 4:
|
||||
$axis_type_fa = 'روستایی';
|
||||
break;
|
||||
case 5:
|
||||
$axis_type_fa = 'بزرگراه';
|
||||
break;
|
||||
}
|
||||
|
||||
$this->attributes['axis_type_fa'] = $axis_type_fa;
|
||||
}
|
||||
|
||||
public function setBlockageCauseFa($blockage_cause)
|
||||
{
|
||||
switch ($blockage_cause) {
|
||||
case 1:
|
||||
$blockage_cause_fa = 'برف';
|
||||
break;
|
||||
case 2:
|
||||
$blockage_cause_fa = 'سیل';
|
||||
break;
|
||||
case 3:
|
||||
$blockage_cause_fa = 'رانش و ریزش';
|
||||
break;
|
||||
case 4:
|
||||
$blockage_cause_fa = 'سایر';
|
||||
break;
|
||||
case 5:
|
||||
$blockage_cause_fa = 'طوفان شن';
|
||||
break;
|
||||
}
|
||||
|
||||
$this->attributes['blockage_cause_fa'] = $blockage_cause_fa;
|
||||
}
|
||||
|
||||
public function setPredictionTimeFa($prediction_time)
|
||||
{
|
||||
switch ($prediction_time) {
|
||||
case 1:
|
||||
$prediction_time_fa = 'یک روزه';
|
||||
break;
|
||||
case 2:
|
||||
$prediction_time_fa = 'سه روزه';
|
||||
break;
|
||||
case 3:
|
||||
$prediction_time_fa = 'یک هفته';
|
||||
break;
|
||||
case 4:
|
||||
$prediction_time_fa = 'دو هفته';
|
||||
break;
|
||||
case 5:
|
||||
$prediction_time_fa = 'یک ماه';
|
||||
break;
|
||||
case 6:
|
||||
$prediction_time_fa = 'سه ماه';
|
||||
break;
|
||||
case 7:
|
||||
$prediction_time_fa = 'شش ماه';
|
||||
break;
|
||||
case 8:
|
||||
$prediction_time_fa = 'بیش از شش ماه';
|
||||
break;
|
||||
}
|
||||
|
||||
$this->attributes['prediction_time_fa'] = $prediction_time_fa;
|
||||
}
|
||||
|
||||
}
|
||||
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');
|
||||
}
|
||||
}
|
||||
47
app/Models/CmmsDemo.php
Normal file
47
app/Models/CmmsDemo.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CmmsDemo extends Model
|
||||
{
|
||||
protected $table = 'cmms_demos';
|
||||
|
||||
protected $fillable = [
|
||||
'car_name',
|
||||
'car_group',
|
||||
'car_group_fa',
|
||||
'car_type',
|
||||
'car_type_fa',
|
||||
'machine_code',
|
||||
'estate_no',
|
||||
'build_date',
|
||||
'car_color',
|
||||
'plak_number',
|
||||
'plak_number_right',
|
||||
'plak_number_left',
|
||||
'plak_number_center',
|
||||
'plak_number_char',
|
||||
'body_number',
|
||||
'dam_number',
|
||||
'motor_number',
|
||||
'vin_number',
|
||||
'section',
|
||||
'section_fa',
|
||||
'gps_code',
|
||||
'driver_name',
|
||||
'last_work_value',
|
||||
'unit_name',
|
||||
'status_fa',
|
||||
'status',
|
||||
'repair_hourly_price',
|
||||
'unit_group',
|
||||
'unit_group_fa',
|
||||
'res1',
|
||||
'mobile',
|
||||
'category',
|
||||
'category_fa',
|
||||
'proccessed'
|
||||
];
|
||||
}
|
||||
16
app/Models/Constituency.php
Normal file
16
app/Models/Constituency.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Constituency extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'constituency_id',
|
||||
'constituency_fa',
|
||||
'region'
|
||||
];
|
||||
}
|
||||
12
app/Models/Contactus.php
Normal file
12
app/Models/Contactus.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contactus extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'c_name', 'c_phone', 'c_title', 'c_describe', 'admin_response'
|
||||
];
|
||||
}
|
||||
10
app/Models/ContractEblaghMeli.php
Normal file
10
app/Models/ContractEblaghMeli.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContractEblaghMeli extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
app/Models/ContractMojavezSetad.php
Normal file
10
app/Models/ContractMojavezSetad.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContractMojavezSetad extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
242
app/Models/ContractSubItems.php
Normal file
242
app/Models/ContractSubItems.php
Normal file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\ContractSubItemsHistory;
|
||||
use App\Http\Controllers\Api\ContractSubItemsController;
|
||||
|
||||
class ContractSubItems extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1005,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1006,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1007,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'project_title',
|
||||
'project_type_id',
|
||||
'project_type_fa',
|
||||
'progress_project',
|
||||
'operation_type_id1',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount1',
|
||||
'operation_type_progress1',
|
||||
'operation_type_tonaj1',
|
||||
'operation_type_id2',
|
||||
'operation_type_fa2',
|
||||
'operation_type_unit2',
|
||||
'operation_type_amount2',
|
||||
'operation_type_progress2',
|
||||
'operation_type_tonaj2',
|
||||
'operation_type_id3',
|
||||
'operation_type_fa3',
|
||||
'operation_type_unit3',
|
||||
'operation_type_amount3',
|
||||
'operation_type_progress3',
|
||||
'operation_type_tonaj3',
|
||||
'operation_type_id4',
|
||||
'operation_type_fa4',
|
||||
'operation_type_unit4',
|
||||
'operation_type_amount4',
|
||||
'operation_type_progress4',
|
||||
'operation_type_tonaj4',
|
||||
'project_type_fa_for_chart',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'axis_type_id',
|
||||
'axis_type_fa',
|
||||
'axis_name_id',
|
||||
'axis_name_fa',
|
||||
'start_lat',
|
||||
'end_lat',
|
||||
'start_lng',
|
||||
'end_lng',
|
||||
'followup_priority_project_id',
|
||||
'followup_priority_project',
|
||||
'priority_project',
|
||||
'priority_project_fa',
|
||||
'operator_name',
|
||||
'operator_phone',
|
||||
'created_at_fa',
|
||||
'last_status_id',
|
||||
'last_status_fa',
|
||||
'last_status_fa_for_chart',
|
||||
'last_digit_project',
|
||||
'last_function_operator',
|
||||
'last_payable_operator',
|
||||
'complete_payable',
|
||||
'updated_at_fa',
|
||||
'image_path1',
|
||||
'image_path2',
|
||||
'unique_code',
|
||||
'required_bitumen',
|
||||
'used_bitumen',
|
||||
'bridge_number',
|
||||
'contract_id',
|
||||
'contract_date_from_parent_contract',
|
||||
'start_way_id',
|
||||
'end_way_id',
|
||||
'user_id'
|
||||
];
|
||||
|
||||
protected $table = 'contract_subitems';
|
||||
|
||||
|
||||
public function Contracts()
|
||||
{
|
||||
return $this->belongsTo(Contracts::class, 'contract_id');
|
||||
}
|
||||
|
||||
public function histories()
|
||||
{
|
||||
return $this->hasMany(ContractSubItemsHistory::class, 'subitem_id', 'id');
|
||||
}
|
||||
|
||||
/// Setters
|
||||
public function setAxisTypeFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$axis_type_fa = 'آزادراه';
|
||||
} elseif ($id == '2') {
|
||||
$axis_type_fa = 'بزرگراه';
|
||||
} elseif ($id == '3') {
|
||||
$axis_type_fa = 'اصلی';
|
||||
} elseif ($id == '4') {
|
||||
$axis_type_fa = 'فرعی';
|
||||
} elseif ($id == '5') {
|
||||
$axis_type_fa = 'روستایی';
|
||||
} elseif ($id == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->attributes['axis_type_fa'] = $axis_type_fa;
|
||||
}
|
||||
|
||||
public function setPriorityProjectFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$priority_project_fa = 'کم';
|
||||
} elseif ($id == '2') {
|
||||
$priority_project_fa = 'متوسط';
|
||||
} elseif ($id == '3') {
|
||||
$priority_project_fa = 'زیاد';
|
||||
} elseif ($id == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->attributes['priority_project_fa'] = $priority_project_fa;
|
||||
}
|
||||
|
||||
public function setFollowupPriorityProjectFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$followup_priority_project = 'کم(ماهیت محلی و منطقه ای بدون پیگیری های ویژه در سطح ملی)';
|
||||
} elseif ($id == '2') {
|
||||
$followup_priority_project = 'متوسط (ماهیت ملی یا استانی)';
|
||||
} elseif ($id == '3') {
|
||||
$followup_priority_project = 'زیاد (مورد تاکید و پیگیری ویژه مسیولین محلی یا ملی)';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->attributes['followup_priority_project'] = $followup_priority_project;
|
||||
}
|
||||
|
||||
public function setProjectTypeFa($id)
|
||||
{
|
||||
$this->attributes['project_type_fa'] = (new ContractSubItemsController())->getAllOperationList()[$id]['farsi'];
|
||||
$this->attributes['project_type_fa_for_chart'] = (new ContractSubItemsController())->getAllOperationList()[$id]['chart'];
|
||||
}
|
||||
|
||||
public function setLastStatusFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$last_status['fa'] = 'در حال تجهیز کارگاه';
|
||||
$last_status['chart'] = 'در حال تجهیز کارگاه';
|
||||
} elseif ($id == '2') {
|
||||
$last_status['fa'] = 'در حال اجرا';
|
||||
$last_status['chart'] = 'در حال اجرا';
|
||||
} elseif ($id == '3') {
|
||||
$last_status['fa'] = 'خاتمه یافته و بهره برداری شده';
|
||||
$last_status['chart'] = 'خاتمه یافته';
|
||||
} elseif ($id == '4') {
|
||||
$last_status['fa'] = 'در دست مناقصه';
|
||||
$last_status['chart'] = 'در دست مناقصه';
|
||||
} elseif ($id == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->attributes['last_status_fa'] = $last_status['fa'];
|
||||
$this->attributes['last_status_fa_for_chart'] = $last_status['chart'];
|
||||
}
|
||||
|
||||
public static function getProjectQuery($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$projectQuery = \App\Models\RoadMaintenanceProject::query();
|
||||
} elseif ($id == '2') {
|
||||
$projectQuery = \App\Models\RoadDangerPrevention::query();
|
||||
} elseif ($id == '3') {
|
||||
$projectQuery = \App\Models\RoadUpgradeSafety::query();
|
||||
} elseif ($id == '4') {
|
||||
$projectQuery = \App\Models\RoadTechnicalBuilding::query();
|
||||
} elseif ($id == '5') {
|
||||
$projectQuery = \App\Models\RoadTollhouseManagement::query();
|
||||
} elseif ($id == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
return $projectQuery;
|
||||
}
|
||||
|
||||
public static function checkProgressProjectCondition($status_id, $progress)
|
||||
{
|
||||
if ($status_id == '1') {
|
||||
$progress_project = '10';
|
||||
} elseif ($status_id == '2') {
|
||||
if ($progress > 10 && $progress <= 99) {
|
||||
$progress_project = $progress;
|
||||
} else {
|
||||
return response()->json(['message' => 'progress project is not valid'], 400);
|
||||
|
||||
}
|
||||
} elseif ($status_id == '3') {
|
||||
$progress_project = '100';
|
||||
} elseif ($status_id == '4') {
|
||||
$progress_project = '5';
|
||||
} elseif ($status_id == '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
return $progress_project;
|
||||
}
|
||||
|
||||
}
|
||||
76
app/Models/ContractSubItemsHistory.php
Normal file
76
app/Models/ContractSubItemsHistory.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContractSubItemsHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'project_title',
|
||||
'project_type_id',
|
||||
'project_type_fa',
|
||||
'operation_type_id1',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount1',
|
||||
'operation_type_progress1',
|
||||
'operation_type_tonaj1',
|
||||
'operation_type_id2',
|
||||
'operation_type_fa2',
|
||||
'operation_type_unit2',
|
||||
'operation_type_amount2',
|
||||
'operation_type_progress2',
|
||||
'operation_type_tonaj2',
|
||||
'operation_type_id3',
|
||||
'operation_type_fa3',
|
||||
'operation_type_unit3',
|
||||
'operation_type_amount3',
|
||||
'operation_type_progress3',
|
||||
'operation_type_tonaj3',
|
||||
'operation_type_id4',
|
||||
'operation_type_fa4',
|
||||
'operation_type_unit4',
|
||||
'operation_type_amount4',
|
||||
'operation_type_progress4',
|
||||
'operation_type_tonaj4',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'axis_type_id',
|
||||
'axis_type_fa',
|
||||
'axis_name_id',
|
||||
'axis_name_fa',
|
||||
'start_lat',
|
||||
'end_lat',
|
||||
'start_lng',
|
||||
'end_lng',
|
||||
'followup_priority_project',
|
||||
'priority_project',
|
||||
'operator_name',
|
||||
'operator_phone',
|
||||
'created_at_fa',
|
||||
'last_status_id',
|
||||
'last_status_fa',
|
||||
'last_digit_project',
|
||||
'last_function_operator',
|
||||
'last_payable_operator',
|
||||
'complete_payable',
|
||||
'updated_at_fa',
|
||||
'image_path1',
|
||||
'image_path2',
|
||||
'progress_project',
|
||||
'unique_code',
|
||||
'required_bitumen',
|
||||
'used_bitumen',
|
||||
'bridge_number',
|
||||
'subitem_id',
|
||||
'is_corrected',
|
||||
];
|
||||
|
||||
public function subitem()
|
||||
{
|
||||
return $this->belongsTo(ContractSubItems::class, 'subitem_id', 'id');
|
||||
}
|
||||
}
|
||||
10
app/Models/Contractor.php
Normal file
10
app/Models/Contractor.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contractor extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
87
app/Models/Contracts.php
Normal file
87
app/Models/Contracts.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Province;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Contracts extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1001,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1002,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1003,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
// protected $table = 'contracts';
|
||||
protected $fillable = [
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'office_id',
|
||||
'office_fa',
|
||||
'title',
|
||||
'status_id',
|
||||
'status_fa',
|
||||
'contract_date',
|
||||
'contract_mojavez_data_meli',
|
||||
'contract_mojavez_data_setad',
|
||||
'contract_mojavez',
|
||||
'contract_mojavez_fa',
|
||||
'contract_tarh',
|
||||
'contract_credit_national',
|
||||
'contract_credit_province',
|
||||
'contract_credit',
|
||||
'contract_peymankar',
|
||||
'contract_moshaver_tarahi',
|
||||
'contract_moshaver_nezarat',
|
||||
'unique_id',
|
||||
'created_at_fa',
|
||||
'contract_mojavez_array',
|
||||
'contract_mojavez_data_meli_array',
|
||||
'contract_mojavez_data_setad_array',
|
||||
'contract_credit_national_array',
|
||||
'contract_tarh_array',
|
||||
'contract_mojavez_fa_array',
|
||||
'contract_credit_headquarter',
|
||||
// 'status',
|
||||
'user_id',
|
||||
'national_credit_license',
|
||||
'province_credit_license',
|
||||
'headquarter_issued_license',
|
||||
'province_issued_license'
|
||||
];
|
||||
|
||||
public function subitems()
|
||||
{
|
||||
return $this->hasMany(ContractSubItems::class, 'contract_id');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo(Province::class, 'province_id');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
68
app/Models/Coridor.php
Normal file
68
app/Models/Coridor.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Coridor extends Model
|
||||
{
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1052,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1053,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'city_name',
|
||||
'name',
|
||||
'status',
|
||||
'type',
|
||||
'team_num',
|
||||
'staff_num',
|
||||
'phone',
|
||||
'responsible_name',
|
||||
'responsible_mobile',
|
||||
'successor_name',
|
||||
'successor_mobile',
|
||||
'machine_data',
|
||||
'team_data',
|
||||
'code',
|
||||
'lat',
|
||||
'lng',
|
||||
'start_lat',
|
||||
'start_lng',
|
||||
'geometry',
|
||||
'color',
|
||||
'end_lat',
|
||||
'end_lng'
|
||||
];
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\PointFile', 'point_fileable');
|
||||
}
|
||||
|
||||
public function rahdariPointHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RahdariPointHistory', 'point_id');
|
||||
}
|
||||
}
|
||||
97
app/Models/DailyAccident.php
Normal file
97
app/Models/DailyAccident.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\DailyAccidentHistory;
|
||||
|
||||
class DailyAccident extends Model
|
||||
{
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1118);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1120,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function histories()
|
||||
{
|
||||
return $this->hasMany(DailyAccidentHistory::class, 'subject_id', 'id');
|
||||
}
|
||||
|
||||
public function setAxisDirectionFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$direction_fa = 'رفت';
|
||||
} elseif ($id == '2') {
|
||||
$direction_fa = 'برگشت';
|
||||
}
|
||||
|
||||
$this->attributes['direction_fa'] = $direction_fa;
|
||||
}
|
||||
|
||||
public function setWeatherConditionFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$weather_condition_fa = 'برفی';
|
||||
} elseif ($id == '2') {
|
||||
$weather_condition_fa = 'کولاک';
|
||||
} elseif ($id == '3') {
|
||||
$weather_condition_fa = 'آفتابی';
|
||||
} elseif ($id == '4') {
|
||||
$weather_condition_fa = 'بارانی';
|
||||
} elseif ($id == '5') {
|
||||
$weather_condition_fa = 'یخبندان';
|
||||
} elseif ($id == '6') {
|
||||
$weather_condition_fa = 'مه آلود';
|
||||
}
|
||||
|
||||
$this->attributes['weather_condition_fa'] = $weather_condition_fa;
|
||||
}
|
||||
|
||||
public function setWayGeometriFa($id)
|
||||
{
|
||||
if ($id == '1') {
|
||||
$way_geometri_fa = "تقاطع - دسترسی";
|
||||
} elseif ($id == '2') {
|
||||
$way_geometri_fa = "قوس افقی یا قائم";
|
||||
} elseif ($id == '3') {
|
||||
$way_geometri_fa = "پل";
|
||||
} elseif ($id == '4') {
|
||||
$way_geometri_fa = "پل و قوس";
|
||||
} elseif ($id == '5') {
|
||||
$way_geometri_fa = "تونل";
|
||||
} elseif ($id == '6') {
|
||||
$way_geometri_fa = "میدان";
|
||||
} elseif ($id == '7') {
|
||||
$way_geometri_fa = "دوربرگردان";
|
||||
} elseif ($id == '8') {
|
||||
$way_geometri_fa = "بریدگی";
|
||||
} elseif ($id == '9') {
|
||||
$way_geometri_fa = "تقاطع و قوس";
|
||||
} elseif ($id == '10') {
|
||||
$way_geometri_fa = "نقطه عادی";
|
||||
}
|
||||
|
||||
$this->attributes['way_geometri_fa'] = $way_geometri_fa;
|
||||
}
|
||||
}
|
||||
10
app/Models/DailyAccidentHistory.php
Normal file
10
app/Models/DailyAccidentHistory.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DailyAccidentHistory extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
app/Models/DailyAccidentSettings.php
Normal file
10
app/Models/DailyAccidentSettings.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DailyAccidentSettings extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
17
app/Models/Damage.php
Normal file
17
app/Models/Damage.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Damage extends Model
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'damage_id',
|
||||
];
|
||||
public function accidents()
|
||||
{
|
||||
return $this->belongsToMany('App\Accident');
|
||||
}
|
||||
}
|
||||
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');
|
||||
}
|
||||
}
|
||||
41
app/Models/DangerPointAccident.php
Normal file
41
app/Models/DangerPointAccident.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DangerPointAccident extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'serial_number',
|
||||
'accident_date',
|
||||
'day',
|
||||
'time',
|
||||
'accident_direction',
|
||||
'collision_type',
|
||||
'accident_factors',
|
||||
'accident_type',
|
||||
'accident_result'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'accident_factors' => 'array',
|
||||
'accident_result' => 'array'
|
||||
];
|
||||
|
||||
public function dangerPoint()
|
||||
{
|
||||
return $this->belongsTo('App\Models\DangerPoint');
|
||||
}
|
||||
}
|
||||
60
app/Models/DangerPointHistory.php
Normal file
60
app/Models/DangerPointHistory.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DangerPointHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_code',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_axis_start',
|
||||
'previous_axis_end',
|
||||
'previous_distance_axis_start',
|
||||
'previous_local_name',
|
||||
'previous_lat',
|
||||
'previous_lng',
|
||||
'previous_accident_251',
|
||||
'previous_accident_251_code',
|
||||
'previous_speed_limit',
|
||||
'previous_speed_average',
|
||||
'previous_accident_possibility',
|
||||
'previous_road_guard',
|
||||
'previous_geometric_desc',
|
||||
'previous_accident_cause',
|
||||
'previous_accident_cause_suggest',
|
||||
'previous_accident_severity',
|
||||
'previous_accident_severity_suggest',
|
||||
'previous_correction_plan_done',
|
||||
'previous_correction_plan_doing',
|
||||
'previous_correction_plan_doing_desc',
|
||||
'previous_correction_plan_doing_suggest',
|
||||
'previous_signature_file',
|
||||
'previous_status',
|
||||
'previous_status_desc',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_accident_cause' => 'array',
|
||||
'previous_accident_severity' => 'array'
|
||||
];
|
||||
|
||||
public function dangerPoint()
|
||||
{
|
||||
return $this->belongsTo('App\Models\DangerPoint');
|
||||
}
|
||||
}
|
||||
20
app/Models/EdarateOstani.php
Normal file
20
app/Models/EdarateOstani.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EdarateOstani extends Model
|
||||
{
|
||||
protected $table = 'edarate_ostani';
|
||||
|
||||
public function roadObserved()
|
||||
{
|
||||
return $this->morphMany(RoadObserved::class, 'handler');
|
||||
}
|
||||
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->morphMany(RoadItemsProject::class, 'edarat');
|
||||
}
|
||||
}
|
||||
30
app/Models/EdarateShahri.php
Normal file
30
app/Models/EdarateShahri.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EdarateShahri extends Model
|
||||
{
|
||||
protected $table = 'edarate_shahri';
|
||||
|
||||
public function cities()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\City', 'edarate_shahri_be_city')->withPivot('is_primary','id');
|
||||
}
|
||||
|
||||
public function roadObserved()
|
||||
{
|
||||
return $this->hasMany(RoadObserved::class);
|
||||
}
|
||||
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->morphMany(RoadItemsProject::class, 'edarat');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
}
|
||||
11
app/Models/HttpErorrsList.php
Normal file
11
app/Models/HttpErorrsList.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HttpErorrsList extends Model
|
||||
{
|
||||
protected $table = 'http_errors_list';
|
||||
|
||||
}
|
||||
14
app/Models/InfoItem.php
Normal file
14
app/Models/InfoItem.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class InfoItem extends Model
|
||||
{
|
||||
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadItemsProject', 'sub_item', 'sub_item');
|
||||
}
|
||||
}
|
||||
48
app/Models/JaheshOperation.php
Normal file
48
app/Models/JaheshOperation.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class JaheshOperation extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'province_id',
|
||||
'created_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'operation_1' => 'array',
|
||||
'operation_2' => 'array',
|
||||
'operation_3' => 'array',
|
||||
'operation_4' => 'array',
|
||||
'operation_5' => 'array',
|
||||
'operation_6' => 'array',
|
||||
'operation_7' => 'array',
|
||||
'operation_8' => 'array',
|
||||
'operation_9' => 'array',
|
||||
'operation_10' => 'array',
|
||||
'operation_11' => 'array',
|
||||
'operation_12' => 'array'
|
||||
];
|
||||
|
||||
public function operationHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\JaheshOperationHistory');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
}
|
||||
54
app/Models/JaheshOperationHistory.php
Normal file
54
app/Models/JaheshOperationHistory.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class JaheshOperationHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_operation_1',
|
||||
'previous_operation_2',
|
||||
'previous_operation_3',
|
||||
'previous_operation_4',
|
||||
'previous_operation_5',
|
||||
'previous_operation_6',
|
||||
'previous_operation_7',
|
||||
'previous_operation_8',
|
||||
'previous_operation_9',
|
||||
'previous_operation_10',
|
||||
'previous_operation_11',
|
||||
'previous_operation_12'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_operation_1' => 'array',
|
||||
'previous_operation_2' => 'array',
|
||||
'previous_operation_3' => 'array',
|
||||
'previous_operation_4' => 'array',
|
||||
'previous_operation_5' => 'array',
|
||||
'previous_operation_6' => 'array',
|
||||
'previous_operation_7' => 'array',
|
||||
'previous_operation_8' => 'array',
|
||||
'previous_operation_9' => 'array',
|
||||
'previous_operation_10' => 'array',
|
||||
'previous_operation_11' => 'array',
|
||||
'previous_operation_12' => 'array'
|
||||
];
|
||||
|
||||
public function jaheshOperation()
|
||||
{
|
||||
return $this->belongsTo('App\Models\JaheshOperation');
|
||||
}
|
||||
}
|
||||
58
app/Models/LawmakersCorrespondence.php
Normal file
58
app/Models/LawmakersCorrespondence.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LawmakersCorrespondence extends Model
|
||||
{
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1025,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1026,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1027,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'unique_code',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'constituency_id',
|
||||
'constituency_fa',
|
||||
'lawmaker_name',
|
||||
'project_name',
|
||||
'unit_id',
|
||||
'unit_fa',
|
||||
'amount',
|
||||
'total_credit',
|
||||
'national_credit',
|
||||
'province_credit',
|
||||
'licence_credit',
|
||||
'preaction_by_setad',
|
||||
'action_by_province',
|
||||
'needed_actions',
|
||||
'last_status',
|
||||
'last_status_id',
|
||||
'last_update_fa',
|
||||
];
|
||||
}
|
||||
10
app/Models/LogList.php
Normal file
10
app/Models/LogList.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LogList extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
61
app/Models/NewRandD.php
Normal file
61
app/Models/NewRandD.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NewRandD extends Model
|
||||
{
|
||||
protected $table = 'new_randd';
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1060,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1061,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1062,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'domain_fa',
|
||||
'domain_id',
|
||||
'project_amount',
|
||||
'credit_status',
|
||||
'rfp_file',
|
||||
'unique_code',
|
||||
'created_time_jalali',
|
||||
'fname_creator',
|
||||
'lname_creator',
|
||||
'phone_creator',
|
||||
'operation_status',
|
||||
'proj_credit_resourse',
|
||||
'unique_id',
|
||||
'project_status'
|
||||
];
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo(Province::class, 'province_id');
|
||||
}
|
||||
}
|
||||
20
app/Models/ObservedItem.php
Normal file
20
app/Models/ObservedItem.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ObservedItem extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function roadPatrol()
|
||||
{
|
||||
return $this->belongsTo(RoadPatrol::class);
|
||||
}
|
||||
|
||||
public function roadItemProject()
|
||||
{
|
||||
return $this->belongsTo(RoadItemsProject::class, 'road_item_id');
|
||||
}
|
||||
}
|
||||
14
app/Models/Otp.php
Normal file
14
app/Models/Otp.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Otp extends Model
|
||||
{
|
||||
protected $guarded = [
|
||||
'id',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
}
|
||||
16
app/Models/PasswordReset.php
Normal file
16
app/Models/PasswordReset.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PasswordReset extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'token',
|
||||
'code',
|
||||
'expired_at',
|
||||
'status'
|
||||
];
|
||||
}
|
||||
38
app/Models/PointFile.php
Normal file
38
app/Models/PointFile.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PointFile extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'point_fileable_id',
|
||||
'point_fileable_type',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'path'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the owning point_fileable model.
|
||||
*/
|
||||
public function point_fileable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
72
app/Models/ProjectFile.php
Normal file
72
app/Models/ProjectFile.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ProjectFile extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'id',
|
||||
// 'project_fileable_id',
|
||||
// 'project_fileable_type',
|
||||
'lat',
|
||||
'lng'
|
||||
// 'created_at',
|
||||
// 'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'path',
|
||||
'project_fileable_id',
|
||||
'project_fileable_type',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public $appends = ['full_path_for_fast_react'];
|
||||
|
||||
/**
|
||||
* Get the owning project_fileable model.
|
||||
*/
|
||||
public function project_fileable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function getFullPathForFastReactAttribute(){
|
||||
|
||||
$path = Storage::disk('public')->url($this->path);
|
||||
$path = str_replace('public/', '', $path);
|
||||
return $path;
|
||||
}
|
||||
// public function getBeforeAttribute(){
|
||||
// $path = Storage::disk('public')->url($this->path);
|
||||
// $pos = strpos($path, 'before');
|
||||
// if ($pos === false) {
|
||||
// return 0;///// 0 before
|
||||
// } else {
|
||||
// return 1;////// 1 after
|
||||
// }
|
||||
// }
|
||||
// public function getAfterAttribute(){
|
||||
// $path = Storage::disk('public')->url($this->path);
|
||||
// $pos = strpos($path, 'after');
|
||||
// if ($pos === false) {
|
||||
// return 0;///// 0 before
|
||||
// } else {
|
||||
// return 1;////// 1 after
|
||||
// }
|
||||
// }
|
||||
}
|
||||
87
app/Models/Proposal.php
Normal file
87
app/Models/Proposal.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Proposal extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1016,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1017,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1018,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'project_title',
|
||||
'project_type_id',
|
||||
'project_type_fa',
|
||||
'office_id',
|
||||
'office_fa',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'axis_type_id',
|
||||
'axis_type_fa',
|
||||
'axis_name',
|
||||
'followup_priority_project_id',
|
||||
'followup_priority_project',
|
||||
'priority_project',
|
||||
'priority_project_fa',
|
||||
'status_id',
|
||||
'status_fa',
|
||||
'operation_type_id1',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount1',
|
||||
'operation_type_id2',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount2',
|
||||
'operation_type_id3',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount3',
|
||||
'operation_type_id4',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount4',
|
||||
'start_lat',
|
||||
'end_lat',
|
||||
'start_lng',
|
||||
'end_lng',
|
||||
'user_id',
|
||||
'user_description',
|
||||
'national_credit',
|
||||
'province_credit',
|
||||
'created_at_fa',
|
||||
'updated_at_fa',
|
||||
'unique_code',
|
||||
];
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
}
|
||||
55
app/Models/ProposalHistory.php
Normal file
55
app/Models/ProposalHistory.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProposalHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'project_title',
|
||||
'project_type_id',
|
||||
'project_type_fa',
|
||||
'office_id',
|
||||
'office_fa',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'axis_type_id',
|
||||
'axis_type_fa',
|
||||
'axis_name',
|
||||
'followup_priority_project_id',
|
||||
'followup_priority_project',
|
||||
'priority_project',
|
||||
'priority_project_fa',
|
||||
'status_id',
|
||||
'status_fa',
|
||||
'operation_type_id1',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount1',
|
||||
'operation_type_id2',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount2',
|
||||
'operation_type_id3',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount3',
|
||||
'operation_type_id4',
|
||||
'operation_type_fa1',
|
||||
'operation_type_unit1',
|
||||
'operation_type_amount4',
|
||||
'start_lat',
|
||||
'end_lat',
|
||||
'start_lng',
|
||||
'end_lng',
|
||||
'user_id',
|
||||
'user_description',
|
||||
'national_credit',
|
||||
'province_credit',
|
||||
'created_at_fa',
|
||||
'updated_at_fa',
|
||||
'unique_code',
|
||||
'proposal_id'
|
||||
];
|
||||
}
|
||||
77
app/Models/Province.php
Normal file
77
app/Models/Province.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Province extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'feature_id',
|
||||
//'center_lat',
|
||||
//'center_long',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function abrarPlanProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\AbrarPlanProject');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadConstructionProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadConstructionProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadItemsProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadPatrolProjects()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\RoadPatrolProject', 'App\Models\User');
|
||||
}
|
||||
|
||||
public function jaheshOperation()
|
||||
{
|
||||
return $this->hasOne('App\Models\JaheshOperation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the projects for the province.
|
||||
*/
|
||||
public function roadMaintenanceProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadMaintenanceProject');
|
||||
}
|
||||
|
||||
public function fastReactionProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadObserved', 'rms_province_id');
|
||||
}
|
||||
public function roadConstructionRural()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadConstructionRural');
|
||||
}
|
||||
}
|
||||
84
app/Models/RahdariPoint.php
Normal file
84
app/Models/RahdariPoint.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RahdariPoint extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1020,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1021,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1022,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'city_name',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'name',
|
||||
'status',
|
||||
'type',
|
||||
'type_fa',
|
||||
'team_num',
|
||||
'staff_num',
|
||||
'phone',
|
||||
'responsible_name',
|
||||
'responsible_mobile',
|
||||
'successor_name',
|
||||
'successor_mobile',
|
||||
'machines_light',
|
||||
'machines_sheavy',
|
||||
'machines_heavy',
|
||||
'code',
|
||||
'lat',
|
||||
'lng',
|
||||
'lat_from',
|
||||
'lng_from',
|
||||
'geometry',
|
||||
'color',
|
||||
'lat_to',
|
||||
'lng_to',
|
||||
'updated_at_fa',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get all of the point's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\PointFile', 'point_fileable');
|
||||
}
|
||||
|
||||
public function rahdariPointHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RahdariPointHistory', 'point_id');
|
||||
}
|
||||
}
|
||||
38
app/Models/RahdariPointHistory.php
Normal file
38
app/Models/RahdariPointHistory.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RahdariPointHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_status',
|
||||
'previous_type',
|
||||
'previous_team_num',
|
||||
'previous_staff_num',
|
||||
'previous_phone',
|
||||
'previous_responsible_name',
|
||||
'previous_responsible_mobile',
|
||||
'previous_successor_name',
|
||||
'previous_successor_mobile',
|
||||
'previous_machines_light',
|
||||
'previous_machines_sheavy',
|
||||
'previous_machines_heavy',
|
||||
'previous_lat',
|
||||
'previous_lng',
|
||||
'new_files',
|
||||
'point_id'
|
||||
];
|
||||
|
||||
public function rahdariPoint()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RahdariPoint');
|
||||
}
|
||||
}
|
||||
15
app/Models/RandDMembers.php
Normal file
15
app/Models/RandDMembers.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RandDMembers extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'member_name',
|
||||
'member_url',
|
||||
'member_duty',
|
||||
'member_office'
|
||||
];
|
||||
}
|
||||
33
app/Models/RandDVoting.php
Normal file
33
app/Models/RandDVoting.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RandDVoting extends Model
|
||||
{
|
||||
protected $table = 'randd_votings';
|
||||
|
||||
protected $fillable = [
|
||||
'project_id',
|
||||
'description',
|
||||
'user_id',
|
||||
'status',
|
||||
];
|
||||
/// relation one to many between Project(NewRandD) and Voting
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(NewRandD::class, 'project_id', 'id');
|
||||
}
|
||||
|
||||
/// Relation one to many between user and voting
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function answers()
|
||||
{
|
||||
return $this->hasMany(RandDVotingPaperAnswer::class, 'vote_id', 'id');
|
||||
}
|
||||
}
|
||||
32
app/Models/RandDVotingPaperAnswer.php
Normal file
32
app/Models/RandDVotingPaperAnswer.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RandDVotingPaperAnswer extends Model
|
||||
{
|
||||
protected $table = 'randd_voting_paper_answers';
|
||||
|
||||
protected $fillable = [
|
||||
'vote_id',
|
||||
'score',
|
||||
'score_type',
|
||||
'description',
|
||||
'user_id',
|
||||
'q_id',
|
||||
'q_fa',
|
||||
'fullname'
|
||||
];
|
||||
|
||||
public function vote()
|
||||
{
|
||||
return $this->belongsTo(RandDVoting::class, 'vote_id', 'id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
}
|
||||
17
app/Models/ReportSummary.php
Normal file
17
app/Models/ReportSummary.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ReportSummary extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $table = 'rms_reports_summary';
|
||||
|
||||
protected $casts = [
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
}
|
||||
61
app/Models/ResearchDev.php
Normal file
61
app/Models/ResearchDev.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ResearchDev extends Model
|
||||
{
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function($model){
|
||||
});
|
||||
|
||||
self::created(function($model){
|
||||
auth()->user()->addActivityComplete(1056,$model);
|
||||
});
|
||||
|
||||
self::updating(function($model){
|
||||
auth()->user()->addActivityComplete(1057,$model);
|
||||
});
|
||||
|
||||
self::updated(function($model){
|
||||
});
|
||||
|
||||
self::deleting(function($model){
|
||||
auth()->user()->addActivityComplete(1058,$model);
|
||||
});
|
||||
|
||||
self::deleted(function($model){
|
||||
});
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'project_title',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'project_agent',
|
||||
'final_report_one',
|
||||
'final_report_two',
|
||||
'final_report_three',
|
||||
'final_report_four',
|
||||
'project_status',
|
||||
'contract_amount',
|
||||
'contract_date',
|
||||
'contract_number',
|
||||
'contract_term',
|
||||
'domain_fa',
|
||||
'contract_status',
|
||||
'uuid',
|
||||
'domain_id',
|
||||
'unique_id',
|
||||
];
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo(Province::class, 'province_id');
|
||||
}
|
||||
}
|
||||
21
app/Models/RmsEvent.php
Normal file
21
app/Models/RmsEvent.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class RmsEvent extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
public function eventHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RmsEventHistory');
|
||||
}
|
||||
}
|
||||
29
app/Models/RmsEventHistory.php
Normal file
29
app/Models/RmsEventHistory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RmsEventHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'status',
|
||||
'path_file'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
public function rmsEvent()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RmsEvent');
|
||||
}
|
||||
}
|
||||
32
app/Models/RoadConstructionProject.php
Normal file
32
app/Models/RoadConstructionProject.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadConstructionProject extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'operation_sub_types' => 'array',
|
||||
'physical_progress' => 'array',
|
||||
'project_stop_reasons' => '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');
|
||||
}
|
||||
}
|
||||
76
app/Models/RoadConstructionRural.php
Normal file
76
app/Models/RoadConstructionRural.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadConstructionRural 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\RoadConstructionRuralHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadConstructionRuralHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
}
|
||||
64
app/Models/RoadConstructionRuralHistory.php
Normal file
64
app/Models/RoadConstructionRuralHistory.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadConstructionRuralHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadConstructionRural');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
|
||||
77
app/Models/RoadDangerPrevention.php
Normal file
77
app/Models/RoadDangerPrevention.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadDangerPrevention extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
// 'province_id',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
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'
|
||||
];
|
||||
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\RoadDangerPreventionHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadDangerPreventionHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
}
|
||||
58
app/Models/RoadDangerPreventionHistory.php
Normal file
58
app/Models/RoadDangerPreventionHistory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadDangerPreventionHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadDangerPrevention');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
166
app/Models/RoadItemsProject.php
Normal file
166
app/Models/RoadItemsProject.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadItemsProject extends Model
|
||||
{
|
||||
///start_way_id
|
||||
///end_way_id
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'user_id',
|
||||
'start_lat',
|
||||
'start_lng',
|
||||
'end_lat',
|
||||
'end_lng',
|
||||
'project_distance',
|
||||
'item',
|
||||
'item_fa',
|
||||
'sub_item',
|
||||
'sub_item_fa',
|
||||
'sub_item_data',
|
||||
'sub_items',
|
||||
'sub_items_data',
|
||||
'unit_fa',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_at_fa',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'user_name',
|
||||
'is_new',
|
||||
'parent_id ',
|
||||
'start_way_id',
|
||||
'end_way_id',
|
||||
'info_id',
|
||||
'status',
|
||||
'status_fa',
|
||||
'supervisor_id',
|
||||
'supervisor_description',
|
||||
'supervising_time',
|
||||
'edarat_id',
|
||||
'edarat_name',
|
||||
'edarat_type',
|
||||
'supervisor_name',
|
||||
'activity_date',
|
||||
'activity_time',
|
||||
'activity_date_time',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'sub_items' => 'array',
|
||||
'sub_items_data' => 'array'
|
||||
];
|
||||
|
||||
public function subitem()
|
||||
{
|
||||
return $this->belongsTo('App\Models\InfoItem', 'sub_item', 'sub_item');
|
||||
}
|
||||
|
||||
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 edarat()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function observedItem()
|
||||
{
|
||||
return $this->hasOne(ObservedItem::class);
|
||||
}
|
||||
|
||||
public static function store(User $user, array $attributes, UploadedFile $before_image = null, UploadedFile $after_image = null, int $observed_item_id = null)
|
||||
{
|
||||
try {
|
||||
$road_item = \DB::transaction(function () use ($user, $attributes, $before_image, $after_image, $observed_item_id) {
|
||||
$road_item = $user->roadItemsProjects()->create([
|
||||
'start_lat' => $attributes['start_lat'],
|
||||
'start_lng' => $attributes['start_lng'],
|
||||
'end_lat' => $attributes['end_lat'],
|
||||
'end_lng' => $attributes['end_lng'],
|
||||
// 'project_distance' => $attributes['project_distance'],
|
||||
'item' => $attributes['item'],
|
||||
'item_fa' => $attributes['item_fa'],
|
||||
'sub_item' => $attributes['sub_item'],
|
||||
'sub_item_fa' => $attributes['sub_item_fa'],
|
||||
'sub_item_data' => $attributes['sub_item_data'],
|
||||
'province_id' => $attributes['province_id'],
|
||||
'province_fa' => $attributes['province_fa'],
|
||||
'city_id' => $attributes['city_id'],
|
||||
'city_fa' => $attributes['city_fa'],
|
||||
'user_name' => $attributes['user_name'],
|
||||
'start_way_id' => $attributes['start_way_id'],
|
||||
'end_way_id' => $attributes['end_way_id'],
|
||||
'unit_fa' => $attributes['unit_fa'],
|
||||
'created_at_fa' => $attributes['created_at_fa'],
|
||||
'info_id' => $attributes['info_id'],
|
||||
'status' => $attributes['status'],
|
||||
'status_fa' => $attributes['status_fa'],
|
||||
'edarat_id' => $attributes['edarat_id'],
|
||||
'edarat_name' => $attributes['edarat_name'],
|
||||
'edarat_type' => $attributes['edarat_type'],
|
||||
'activity_date' => $attributes['activity_date'],
|
||||
'activity_time' => $attributes['activity_time'],
|
||||
'activity_date_time' => $attributes['activity_date']." ".$attributes['activity_time'],
|
||||
'is_new' => 1,
|
||||
|
||||
]);
|
||||
|
||||
// if ($info_item->needs_image) {
|
||||
if ($after_image) {
|
||||
$after = $after_image->store('road_items_projects_new/after', 'public');
|
||||
$road_item->files()->create(['path' => $after]);
|
||||
$urlAfter = "/var/www/rms/public/storage/{$after}";
|
||||
// \App\Helpers\Compress::resize($urlAfter);
|
||||
}
|
||||
if ($before_image) {
|
||||
$before = $before_image->store('/road_items_projects_new/before', 'public');
|
||||
$road_item->files()->create(['path' => $before]);
|
||||
$urlBefore = "/var/www/rms/public/storage/{$before}";
|
||||
// \App\Helpers\Compress::resize($urlBefore);
|
||||
}
|
||||
// }
|
||||
|
||||
// if has observed item save project
|
||||
if ($observed_item_id) {
|
||||
if (ObservedItem::where('id', $observed_item_id)->whereNotNull('road_item_id')->exists()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ObservedItem::where('id', $observed_item_id)
|
||||
->update([
|
||||
'road_item_id' => $road_item->id
|
||||
]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
return $road_item;
|
||||
} catch (\Throwable $th) {
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
}
|
||||
76
app/Models/RoadMaintenanceProject.php
Normal file
76
app/Models/RoadMaintenanceProject.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadMaintenanceProject 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\RoadMaintenanceProjectHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadMaintenanceProjectHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
}
|
||||
64
app/Models/RoadMaintenanceProjectHistory.php
Normal file
64
app/Models/RoadMaintenanceProjectHistory.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadMaintenanceProjectHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadMaintenanceProject');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
|
||||
}
|
||||
22
app/Models/RoadObservationHistory.php
Normal file
22
app/Models/RoadObservationHistory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadObservationHistory extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [];
|
||||
|
||||
public function problem()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadObserved');
|
||||
}
|
||||
}
|
||||
99
app/Models/RoadObserved.php
Normal file
99
app/Models/RoadObserved.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadObserved extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'AutoID',
|
||||
'Title',
|
||||
'StartTime',
|
||||
'EndTime',
|
||||
'StartDate',
|
||||
'EndDate',
|
||||
'StartTime_DateTime',
|
||||
'EndTime_DateTime',
|
||||
'fk_RegisteredEventMessage',
|
||||
'fk_Country',
|
||||
'ProvinceName',
|
||||
'fk_Province',
|
||||
'fk_Town',
|
||||
'TownName',
|
||||
'lat',
|
||||
'lng',
|
||||
'XLAM',
|
||||
'YLAM',
|
||||
'WeatherName',
|
||||
'fk_Weather',
|
||||
'EventTypeTitle',
|
||||
'fk_EventType',
|
||||
'FeatureTypeTitle',
|
||||
'fk_FeatureType',
|
||||
'Description',
|
||||
'MobileForSendEventSms',
|
||||
'rms_province_id',
|
||||
'rms_city_id',
|
||||
'handling_way_id',
|
||||
'StartTime_DateTime_fa',
|
||||
'updated_at_fa',
|
||||
'updated_at',
|
||||
'observed_way_id',
|
||||
'rms_last_activity',
|
||||
'rms_last_activity_fa',
|
||||
'image_after',
|
||||
'image_before',
|
||||
// 'handler_type',
|
||||
'edarate_shahri_id',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'province_fa',
|
||||
'city_fa',
|
||||
'rms_status',
|
||||
'status',
|
||||
'status_fa',
|
||||
'supervisor_id',
|
||||
'supervisor_description',
|
||||
'supervising_time',
|
||||
'supervisor_name',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'rms_start_latlng' => 'array',
|
||||
'rms_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get all of the project's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
|
||||
public function problemHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadObservedHistory', 'problem_id');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province', 'rms_province_id');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City', 'rms_city_id');
|
||||
}
|
||||
|
||||
public function edarateShahri()
|
||||
{
|
||||
return $this->belongsTo('App\Models\EdarateShahri', 'edarate_shahri_id');
|
||||
}
|
||||
}
|
||||
37
app/Models/RoadObservedHistory.php
Normal file
37
app/Models/RoadObservedHistory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadObservedHistory extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_rms_status',
|
||||
'previous_rms_start_latlng',
|
||||
'previous_rms_end_latlng',
|
||||
'previous_rms_description',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_rms_start_latlng' => 'array',
|
||||
'previous_rms_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function problem()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadObserved');
|
||||
}
|
||||
}
|
||||
15
app/Models/RoadPatrol.php
Normal file
15
app/Models/RoadPatrol.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadPatrol extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function observedItems()
|
||||
{
|
||||
return $this->hasMany(ObservedItem::class);
|
||||
}
|
||||
}
|
||||
37
app/Models/RoadPatrolProject.php
Normal file
37
app/Models/RoadPatrolProject.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\ReportAble;
|
||||
|
||||
class RoadPatrolProject extends Model
|
||||
{
|
||||
use ReportAble;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'start_lat',
|
||||
'start_lng',
|
||||
'end_lat',
|
||||
'end_lng',
|
||||
'project_distance',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'start_way_id',
|
||||
'end_way_id',
|
||||
];
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
public function roadPatrolSubProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadPatrolSubProject');
|
||||
}
|
||||
}
|
||||
44
app/Models/RoadPatrolSubProject.php
Normal file
44
app/Models/RoadPatrolSubProject.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadPatrolSubProject extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'project_lat',
|
||||
'project_lng',
|
||||
'item',
|
||||
'sub_items',
|
||||
'sub_items_data'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'sub_items' => 'array',
|
||||
'sub_items_data' => 'array'
|
||||
];
|
||||
|
||||
public function roadPatrolProject()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadPatrolProject');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the project's files.
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
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');
|
||||
}
|
||||
}
|
||||
58
app/Models/RoadTechnicalBuildingHistory.php
Normal file
58
app/Models/RoadTechnicalBuildingHistory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadTechnicalBuildingHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadTechnicalBulding');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
77
app/Models/RoadTollhouseManagement.php
Normal file
77
app/Models/RoadTollhouseManagement.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadTollhouseManagement extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $table = 'road_tollhouse_managements';
|
||||
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\RoadTollhouseManagementHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadTollhouseManagementHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
}
|
||||
58
app/Models/RoadTollhouseManagementHistory.php
Normal file
58
app/Models/RoadTollhouseManagementHistory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadTollhouseManagementHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadTollhouseManagement');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
77
app/Models/RoadUpgradeSafety.php
Normal file
77
app/Models/RoadUpgradeSafety.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadUpgradeSafety 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\RoadUpgradeSafetyHistory', 'project_id');
|
||||
}
|
||||
|
||||
public function latestHistory()
|
||||
{
|
||||
return $this->hasOne('App\Models\RoadUpgradeSafetyHistory', 'project_id')->latest();
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City');
|
||||
}
|
||||
|
||||
}
|
||||
58
app/Models/RoadUpgradeSafetyHistory.php
Normal file
58
app/Models/RoadUpgradeSafetyHistory.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoadUpgradeSafetyHistory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'previous_axis_name',
|
||||
'previous_axis_type',
|
||||
'previous_project_name',
|
||||
'previous_cities_id',
|
||||
'previous_contractor_name',
|
||||
'previous_consultant_name',
|
||||
'previous_contract_date',
|
||||
'previous_contract_credit',
|
||||
'previous_start_latlng',
|
||||
'previous_end_latlng',
|
||||
'previous_team_latlng',
|
||||
'previous_stop_reason',
|
||||
'previous_submited_at',
|
||||
'previous_last_updated_at',
|
||||
'previous_project_distance',
|
||||
'previous_project_distance_update',
|
||||
'previous_contractor_credit',
|
||||
'previous_physical_progress',
|
||||
'previous_description',
|
||||
'previous_status',
|
||||
'previous_project_status',
|
||||
'new_files'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'previous_cities_id' => 'array',
|
||||
'previous_project_distance' => 'array',
|
||||
'previous_project_distance_update' => 'array',
|
||||
'previous_start_latlng' => 'array',
|
||||
'previous_team_latlng' => 'array',
|
||||
'previous_end_latlng' => 'array'
|
||||
];
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo('App\Models\RoadUpgradeSafety');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany('App\Models\ProjectFile', 'project_fileable');
|
||||
}
|
||||
}
|
||||
17
app/Models/Role.php
Normal file
17
app/Models/Role.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends \Spatie\Permission\Models\Role
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'name_fa',
|
||||
'description',
|
||||
'for_report',
|
||||
'guard_name'
|
||||
];
|
||||
}
|
||||
14
app/Models/RoutePath.php
Normal file
14
app/Models/RoutePath.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoutePath extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'lat1',
|
||||
'lng1' ];
|
||||
}
|
||||
62
app/Models/SafetyAndPrivacy.php
Normal file
62
app/Models/SafetyAndPrivacy.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\SafetyAndPrivacyReportAble;
|
||||
|
||||
class SafetyAndPrivacy extends Model
|
||||
{
|
||||
use SafetyAndPrivacyReportAble;
|
||||
|
||||
protected $fillable = [
|
||||
'recognize_picture',
|
||||
'lat',
|
||||
'lon',
|
||||
'operator_id',
|
||||
'operator_name',
|
||||
'province_id',
|
||||
'province_fa',
|
||||
'city_id',
|
||||
'city_fa',
|
||||
'info_id',
|
||||
'info_fa',
|
||||
'edare_shahri_id',
|
||||
'edare_shahri_name',
|
||||
'way_id',
|
||||
'activity_date_time',
|
||||
|
||||
];
|
||||
|
||||
public $table = "safety_and_privacy";
|
||||
|
||||
public function goToFirstStep()
|
||||
{
|
||||
if($this->step == 0){
|
||||
$this->step = 1;
|
||||
$this->step_fa = 'گام اول (شناسایی)';
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function goToSecondStep()
|
||||
{
|
||||
if($this->step == 1){
|
||||
$this->step = 2;
|
||||
$this->step_fa = 'گام دوم (اخطار)';
|
||||
|
||||
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function goToThirdStep()
|
||||
{
|
||||
if($this->step == 2){
|
||||
$this->step = 3;
|
||||
$this->step_fa = 'گام سوم (برخورد)';
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
app/Models/SetadProvince.php
Normal file
12
app/Models/SetadProvince.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SetadProvince extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name_fa',
|
||||
];
|
||||
}
|
||||
10
app/Models/TarhList.php
Normal file
10
app/Models/TarhList.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TarhList extends Model
|
||||
{
|
||||
|
||||
}
|
||||
10
app/Models/TechnoTransport.php
Normal file
10
app/Models/TechnoTransport.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TechnoTransport extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
}
|
||||
12
app/Models/Unit.php
Normal file
12
app/Models/Unit.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Unit extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'unit_fa'
|
||||
];
|
||||
}
|
||||
225
app/Models/User.php
Normal file
225
app/Models/User.php
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Spatie\Permission\Traits\HasPermissions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Models\UserActivityLog;
|
||||
use App\Models\LogList;
|
||||
use DB;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable, HasRoles, HasPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password', 'username', 'first_name', 'last_name', 'position', 'mobile', 'province_id', 'city_id', 'confirmed', 'enabled', 'avatar', 'city_fa', 'province_fa', 'degree'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function addActivity($description)
|
||||
{
|
||||
// $temp = new UserActivityLog();
|
||||
// $temp->description = $description;
|
||||
// $temp->user_id = $this->id;
|
||||
// $temp->save();
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
// dd(explode("?", request()->fullUrl())[1]);
|
||||
}
|
||||
|
||||
public function addActivityComplete($log_unique_code, $model = null)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$temp = new UserActivityLog();
|
||||
$temp->user_id = $this->id;
|
||||
$temp->username = $this->username;
|
||||
$temp->user_name = $this->name;
|
||||
$temp->user_first_name = $this->first_name;
|
||||
$temp->user_last_name = $this->last_name;
|
||||
$temp->position = $this->position;
|
||||
$temp->mobile = $this->mobile;
|
||||
$temp->province_id = $this->province_id;
|
||||
$temp->province_fa = $this->province_fa;
|
||||
$temp->city_id = $this->city_id;
|
||||
$temp->city_fa = $this->city_fa;
|
||||
|
||||
$log = LogList::where('log_unique_code', $log_unique_code)->first();
|
||||
$temp->log_unique_code = $log_unique_code;
|
||||
$temp->description = $log->description;
|
||||
$temp->action_type = $log->action_type;
|
||||
|
||||
$temp->agent = request()->header('user-agent') ?? null;
|
||||
$temp->method = request()->method() ?? null;
|
||||
$temp->ip = request()->ip() ?? null;
|
||||
$temp->url = request()->Url() ?? null;
|
||||
$temp->query_parameter = serialize(request()->all());
|
||||
|
||||
$temp->model = serialize($model) ?? null;
|
||||
$temp->save();
|
||||
DB::commit();
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
try {
|
||||
$temp = new UserActivityLog();
|
||||
$temp->user_id = $this->id;
|
||||
$temp->username = $this->username;
|
||||
$temp->user_name = $this->name;
|
||||
$temp->user_first_name = $this->first_name;
|
||||
$temp->user_last_name = $this->last_name;
|
||||
$temp->position = $this->position;
|
||||
$temp->mobile = $this->mobile;
|
||||
$temp->province_id = $this->province_id;
|
||||
$temp->province_fa = $this->province_fa;
|
||||
$temp->city_id = $this->city_id;
|
||||
$temp->city_fa = $this->city_fa;
|
||||
|
||||
$log = LogList::where('log_unique_code', $log_unique_code)->first();
|
||||
$temp->log_unique_code = $log_unique_code;
|
||||
$temp->description = $log->description;
|
||||
$temp->action_type = $log->action_type;
|
||||
|
||||
$temp->agent = request()->header('user-agent') ?? null;
|
||||
$temp->method = request()->method() ?? null;
|
||||
$temp->ip = request()->ip() ?? null;
|
||||
$temp->url = request()->Url() ?? null;
|
||||
$temp->query_parameter = serialize(request()->input());
|
||||
|
||||
$temp->model = serialize($model) ?? null;
|
||||
$temp->save();
|
||||
DB::commit();
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
$temp = new UserActivityLog();
|
||||
$temp->user_id = $this->id;
|
||||
$temp->username = $this->username;
|
||||
$temp->user_name = $this->name;
|
||||
$temp->user_first_name = $this->first_name;
|
||||
$temp->user_last_name = $this->last_name;
|
||||
$temp->position = $this->position;
|
||||
$temp->mobile = $this->mobile;
|
||||
$temp->province_id = $this->province_id;
|
||||
$temp->province_fa = $this->province_fa;
|
||||
$temp->city_id = $this->city_id;
|
||||
$temp->city_fa = $this->city_fa;
|
||||
|
||||
$log = LogList::where('log_unique_code', $log_unique_code)->first();
|
||||
$temp->log_unique_code = $log_unique_code;
|
||||
$temp->description = $log->description;
|
||||
$temp->action_type = $log->action_type;
|
||||
|
||||
$temp->agent = request()->header('user-agent') ?? null;
|
||||
$temp->method = request()->method() ?? null;
|
||||
$temp->ip = request()->ip() ?? null;
|
||||
$temp->url = request()->Url() ?? null;
|
||||
$temp->query_parameter = "Request is to big !!!!!";
|
||||
|
||||
$temp->model = serialize($model) ?? null;
|
||||
$temp->save();
|
||||
DB::commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getUserPermissions()
|
||||
{
|
||||
$permissions = $this->permissions;
|
||||
|
||||
$arrayPermission = [];
|
||||
foreach ($permissions as $permission) {
|
||||
$arrayPermission[] = $permission->name;
|
||||
}
|
||||
|
||||
return $arrayPermission;
|
||||
}
|
||||
|
||||
// A person is Randd member iff he/she only has randd permissions and not other permissions.
|
||||
public function isRandDMember()
|
||||
{
|
||||
return $this->permissions()->where('type','randd')->get()->count() && $this->permissions()->where('type','<>','randd')->get()->count() == 0;
|
||||
}
|
||||
|
||||
public function checkUserHasPermission($permission)
|
||||
{
|
||||
return $this->checkPermissionTo($permission);
|
||||
}
|
||||
|
||||
|
||||
public function roadItemsProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadItemsProject');
|
||||
}
|
||||
|
||||
public function roadConstructionProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadConstructionProject');
|
||||
}
|
||||
|
||||
public function roadPatrolProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadPatrolProject');
|
||||
}
|
||||
|
||||
public function activityLogs()
|
||||
{
|
||||
return $this->hasMany('App\Models\UserActivityLog','user_id');
|
||||
}
|
||||
|
||||
public function province()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province', 'province_id');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo('App\Models\City', 'city_id');
|
||||
}
|
||||
|
||||
public function eventHistories()
|
||||
{
|
||||
return $this->hasMany('App\Models\RmsEventHistory');
|
||||
}
|
||||
|
||||
public function roadMaintenanceProjects()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadMaintenanceProject');
|
||||
}
|
||||
|
||||
public function roadConstructionRural()
|
||||
{
|
||||
return $this->hasMany('App\Models\RoadConstructionRural');
|
||||
}
|
||||
}
|
||||
23
app/Models/UserActivityLog.php
Normal file
23
app/Models/UserActivityLog.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserActivityLog extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'description',
|
||||
'user_id'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
}
|
||||
15
app/Models/WeatherNotice.php
Normal file
15
app/Models/WeatherNotice.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WeatherNotice extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'color',
|
||||
'notice_text',
|
||||
'notice_code'
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user