89 lines
3.0 KiB
PHP
89 lines
3.0 KiB
PHP
<?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));
|
|
}
|
|
}
|