Edit File: ForgetPasswordRequest.php
<?php namespace App\Http\Requests\DelegatesDashboard; use Illuminate\Foundation\Http\FormRequest; use App\Traits\Responses; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\Request; use App\Traits\ApiTrait; use App\Traits\GeneralTrait; use App\Rules\CheckCodeRule; use App; class ForgetPasswordRequest extends FormRequest { use ApiTrait,GeneralTrait; /** * 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 [ 'phone' => 'required', ]; } protected function prepareForValidation() { $number = $this->convert2english($this->phone); $phone = $this->phoneValidate($number); $this->merge([ 'phone' => $phone , ]); } protected function failedValidation( \Illuminate\Contracts\Validation\Validator $validator) { $msg = implode(' , ',$validator->errors()->all()); throw new HttpResponseException(response()->json(['key'=>'fail','msg'=>$msg])); } }
Back to File Manager