Is that possible to use json_decode() in Laravel Request Validation ?

Hello guys , Is that possible to use json_decode() in Laravel Request Validation ?

I have a form in Vue , and I am sending this data with json_encode() And I decode it in PHP .

I have this form request validation -

public function rules()
    {
        return [
            'name'                    => 'required',
            'email'                   => 'required|email' 

        ];
    }

I wold like to do something like this -

   public function rules()
    {
        return [
            'name'                           => 'required',
            json_decode('email')   => 'required|email' 

        ];
    }

but is not possible , is that possible to make the validation Request with the json_decode() ?

Thanks

murilolivorato
murilolivorato
  • 2 months ago

So you are sending part of it as a json object?

Yes , I am sending with json object , and I want to make - json_decode() in laravel Request .