08-06-2023, 04:08 PM
I've been struggling with this for a while now.
Here's the code I've got.
> public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:100'
]);
if ($validator->fails()) {
//do something
}
}
The problem is that I get a FatalThrowableError right in my face with the following message:
> Call to a member function parameter() on array
I can't find what I'm doing wrong. I'd appreciate some help here.
And also, I've had this validation before which worked:
$this->validate($request, [
'name' => 'required|unique:developers|max:100'
]);
But the thing with this one is, I had no idea how to catch when the validation failed. Is it possible to catch the validation fail when using it this way?
Using version: "laravel/lumen-framework": "5.2.*"
Here's the code I've got.
> public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:100'
]);
if ($validator->fails()) {
//do something
}
}
The problem is that I get a FatalThrowableError right in my face with the following message:
> Call to a member function parameter() on array
I can't find what I'm doing wrong. I'd appreciate some help here.
And also, I've had this validation before which worked:
$this->validate($request, [
'name' => 'required|unique:developers|max:100'
]);
But the thing with this one is, I had no idea how to catch when the validation failed. Is it possible to catch the validation fail when using it this way?
Using version: "laravel/lumen-framework": "5.2.*"