inital commit
This commit is contained in:
46
app/Http/Requests/Api/LawmakersRequest.php
Normal file
46
app/Http/Requests/Api/LawmakersRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LawmakersRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'province_id' => 'required',
|
||||
'province_fa' => 'required',
|
||||
'constituency_id' => 'required',
|
||||
'constituency_fa' => 'required',
|
||||
'lawmaker_name' => 'required',
|
||||
'project_name' => 'required',
|
||||
'unit_id' => 'required',
|
||||
'unit_fa' => 'required',
|
||||
'amount' => 'required',
|
||||
'total_credit' => 'required',
|
||||
'national_credit' => 'required',
|
||||
'province_credit' => 'required',
|
||||
'licence_credit' => 'required',
|
||||
'preaction_by_setad' => 'required',
|
||||
'action_by_province' => 'required',
|
||||
'needed_actions' => 'required',
|
||||
'last_action' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
88
app/Http/Requests/Api/ProposalRequest.php
Normal file
88
app/Http/Requests/Api/ProposalRequest.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class ProposalRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(Request $request)
|
||||
{
|
||||
$rules['project_title'] = 'required';
|
||||
$rules['project_type_id'] = 'required';
|
||||
$rules['project_type_fa'] = 'required';
|
||||
$rules['office_id'] = 'required';
|
||||
$rules['office_fa'] = 'required';
|
||||
$rules['province_id'] = 'required';
|
||||
$rules['province_fa'] = 'required';
|
||||
$rules['axis_type_id'] = 'required';
|
||||
$rules['axis_type_fa'] = 'required';
|
||||
$rules['axis_name'] = 'required';
|
||||
$rules['followup_priority_project_id'] = 'required';
|
||||
$rules['followup_priority_project'] = 'required';
|
||||
$rules['priority_project'] = 'required';
|
||||
$rules['priority_project_fa'] = 'required';
|
||||
$rules['start_lat'] = 'required';
|
||||
$rules['end_lat'] = 'required';
|
||||
$rules['start_lng'] = 'required';
|
||||
$rules['end_lng'] = 'required';
|
||||
$rules['national_credit'] = 'required';
|
||||
$rules['follower_person'] = 'required';
|
||||
$rules['follower_person_fa'] = 'required';
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'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' => 'درجه اهمیت پروژه',
|
||||
'start_lat' => 'مختصات',
|
||||
'end_lat' => 'مختصات',
|
||||
'start_lng' => 'مختصات',
|
||||
'end_lng' => 'مختصات',
|
||||
'national_credit' => 'مبلغ اعتبار',
|
||||
'follower_person' => 'مقام پیگیری کننده',
|
||||
'follower_person_fa' => 'مقام پیگیری کننده',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
throw new HttpResponseException(response()->json([
|
||||
'erorr' => $validator->errors()
|
||||
], 400));
|
||||
}
|
||||
}
|
||||
80
app/Http/Requests/Api/StoreContractRequest.php
Normal file
80
app/Http/Requests/Api/StoreContractRequest.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
|
||||
class StoreContractRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(Request $request)
|
||||
{
|
||||
$rules['title'] = 'required';
|
||||
$rules['office_id'] = 'required';
|
||||
$rules['office_fa'] = 'required';
|
||||
$rules['status_fa'] = 'required';
|
||||
$rules['status_id'] = 'required';
|
||||
$rules['province_id'] = 'required|integer|min:1';
|
||||
$rules['contract_date'] = 'required';
|
||||
$rules['contract_credit'] = 'required';
|
||||
$rules['contract_peymankar'] = 'required';
|
||||
// $rules['contract_credit_national'] = 'required';
|
||||
$rules['contract_moshaver_tarahi'] = 'required';
|
||||
$rules['contract_moshaver_nezarat'] = 'required';
|
||||
// $rules['contract_mojavez'] = 'required';
|
||||
// $rules['contract_mojavez_fa'] = 'required';
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'province_id.min' => 'لطفا استان را انتخاب کنید.'
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
'title' => 'عنوان قرارداد',
|
||||
'office_id' => 'اداره کل',
|
||||
'office_fa' => 'اداره کل',
|
||||
'status_fa' => 'وضعیت قرارداد',
|
||||
'status_id' => 'وضعیت قرارداد',
|
||||
'province_fa' => 'استان',
|
||||
'province_id' => 'استان',
|
||||
'contract_date' => 'تاریخ انعقاد قرارداد',
|
||||
'contract_credit' => 'مبلغ کل قرارداد',
|
||||
'contract_peymankar' => 'نام پیمانکار',
|
||||
'contract_credit_national' => 'مبلغ اعتبار ملی',
|
||||
'contract_moshaver_tarahi' => 'نام مشاور طراحی',
|
||||
'contract_moshaver_nezarat' => 'نام مشاور نظارت',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
throw new HttpResponseException(response()->json([
|
||||
'erorr' => $validator->errors()
|
||||
], 400));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user