php - Unable to Run Form Request Validation on Lumen -
we using form request validation laravel. i'm trying use same requests lumen, doesn't work espected.
usercontroller
<?php namespace app\http\controllers; use app\http\requests\user\userpostrequest; use app\macx\logic\interfaces\iuserlogic; use illuminate\http\request; use illuminate\support\facades\auth; class usercontroller extends controller { private $userlogic; public function __construct(iuserlogic $userlogic) { $this->userlogic = $userlogic; } public function post(userpostrequest $request) { return $this->userlogic->post(auth::user(), $request->all()); } }
userpostrequest
<?php namespace app\http\requests\user; use illuminate\support\facades\request; class userpostrequest extends request { /** * determine if user authorized make request. * * * @return bool */ public function authorize() { return true; } /** * validation rules apply request. * * @return array */ public function rules() { return [ 'name'=>'required|min:3|max:255', 'surname'=>'required|min:3|max:255', 'email'=>'required|email|unique:companies', ]; } }
but when call /api/user/ post data i'm getting error :
call undefined method app\http\requests\user\userpostrequest::all()
note: have saw lumen doesn't support form request validation described in documentation : https://lumen.laravel.com/docs/5.4/validation
form requests not supported lumen. if use form requests, should use full laravel framework.
but stuff useful, i'm still trying find solution form request validation.
Comments
Post a Comment