47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V3\Dashboard\Harim\PanjareVahed;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
|
|
class GetAccessRoadRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'request_id' => 'required|exists:harims,panjare_vahed_id',
|
|
'access_road' => 'required|array',
|
|
'access_road.type' => 'required|string',
|
|
'access_road.coordinates' => 'required|array',
|
|
'data' => 'required|string',
|
|
];
|
|
}
|
|
|
|
protected function failedValidation(Validator $validator)
|
|
{
|
|
$response = response()->json([
|
|
'statusCode' => 422,
|
|
'message' => 'invalid inputs',
|
|
'errors' => $validator->errors(),
|
|
], 422);
|
|
|
|
throw new HttpResponseException($response);
|
|
}
|
|
}
|