mercredi 27 janvier 2016

Request validation allways passes on Laravel using Dingo/Api

I'm using dingo/api package.

Controller:

public function register(RegisterUserRequest $request)
{
    dd('a');
}

And for example the email field is required:

<?php namespace App\Http\Requests;


class RegisterUserRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'email' => 'required'
        ];
    }
}

So I send a request without the email, and still getting the "a" response.

I also tried to extend Dingo\Api\Http\Request instead of App\Http\Request, but still the same.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire