samedi 2 février 2019

Pass Customer FormRequest to GET in Laravel

I'm curious is that possible to pass (as type-hinted) of custom class that extends FormRequest to be passed in to action within GET request ?

for example: at routes/api.php

Route::get('/schema', '\App\Http\Controllers\TestController@getSchema');

then I have App\Http\Requests\SchemaRequest.php

and at controller, I want get this request from route within GET method.

class TestController extends Controller {
    public function getSchema(\App\Http\Requests\SchemaRequest $request) {
        // do other stuff here
    }
}

I've tried to look deeper and doing some hack but nothing success yet?

Is that possible?

Any input would be appreciated, and thanks for reading



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire