2017-01-18 114 views
0

Laravel 5.2请求验证在丁格(JWT)API中不起作用。Laravel 5.2请求验证与Dingo(JWT)Api

当我尝试调用控制器方法时,我使用了请求验证,以确定它返回吹动错误的时间。

错误 { “消息”: “500内部服务器错误”, “STATUS_CODE”:500}

控制器

请求

namespace App\Http\Requests; 

    use App\Http\Requests\Request; 

    class StoreBlogPost extends Request { 

    /** 
    * Determine if the user is authorized to make this request. 
    * 
    * @return bool 
    */ 
    public function authorize() { 
    return False; 
    } 

    /** 
    * Get the validation rules that apply to the request. 
    * 
    * @return array 
    */ 
    public function rules() { 
    return [ 
    'FloorKey' => 'required', 
    ]; 
    } 

    public function response(array $error) { 
    //Can't get json responce validation error in Controller 
    return response()->json(['error' => $error], 422); 
    } 

    } 
+0

你能告诉我们你到现在为止做了什么吗? –

+0

@RahulSharma这是我的代码。 –

回答

2

更改请求类App\Http\Requests\RequestDingo\Api\Http\FormRequest