As you know Laravel 5 changes the way you call the validator
, the old way is calling the validator facade
, but now there is the ValidatesRequests
Manix's answer wasn't working for me, I was having the same issues as Iliyass. The issue is route parameters aren't automatically available to the FormRequest. I ended up overriding the all() function in my particular FormRequest Class:
public function all()
{
// Include the next line if you need form data, too.
$request = Input::all();
$request['username'] = $this->route('username');
return $request
}
Then you can code rules as normal:
public function rules()
{
return [
'username' => 'required',
];
}