2017-05-07 52 views
0

我有我的自定義請求RegisterRequest和我試圖使用它,但由於某種原因,我總是得到這個錯誤好像我不包括它:Laravel自定義的請求沒有找到

ReflectionException in RouteSignatureParameters.php line 25: 
Class App\Http\Controllers\RegisterRequest does not exist 

這是我的要求:

<?php 

namespace App\Http\Requests; 

use Illuminate\Foundation\Http\FormRequest; 

class RegisterRequest extends FormRequest 
{ 
    /** 
    * 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 [ 
      'username' => 'required', 
      'email' => 'required', 
      'emailconfirm' => 'required', 
      'password' => 'required', 
      'passwordconfirm' => 'required', 
     ]; 
    } 

    public function messages(){ 
     return [ 
      'username.required' => 'Username is required', 
     ], 
    } 
} 

,這是如何我嘗試使用它:

use App\Http\Requests\RegisterRequest; 

,在我的方法:

public function RegisterPost(RegisterRequest $request){ 

     return response()->json($request->all(),200); 
    } 

我總是得到500個內部服務器錯誤消息,請求不存在。

回答

0

此命令可以幫助:

composer dump-autoload