dimanche 29 janvier 2017

Laravel TransformRequest not applying to own Request classes

The two new middleware classes doesn't apply to my own Requests. The two new middleware are:

\App\Http\Middleware\TrimStrings::class
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class

However, they don't apply their changes to my own requests. Forexample: I have this request:

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class CreateStoreRequest extends FormRequest
{
    public function authorize()
    {
        return Auth::check();
    }

    public function rules()
    {
        var_dump( $this->all() ); // Content not handled by middleware

        return [
            // Rules
        ];
    }
}

When i use var_dump, I can see that the content isn't changed.

If i use Illuminate\Http\Request in my controller it works.

Is there any way to implement the changes in my own request classes?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kfNVZb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire