R
R
Ruslan Absalyamov2018-03-08 22:04:25
Laravel
Ruslan Absalyamov, 2018-03-08 22:04:25

How to handle post requests in laravel with a request to the controller?

I am implementing react frontend and I need to implement api registration. I set up route but I can't figure out how to access the controller that registers the user.
My implementation

Route::post('/registration', [
    'as' => Request::class, 'uses' => '[email protected]'
]);

And tried to go like this
Route::post('/registration', function(Request $request){
// И тут я встал в ступор
});

That is, I send objects to these routes, well, json, but I still don’t understand how to access the controller.
In the first case, I write Class App\Http\Controllers\RegisterController does not exist
Although it exists

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Absalyamov, 2018-03-09
@rusline18

Route::post('/registration', 'Auth\[email protected]');

And in RegisterController you need to remove that the resulting array type and change it to Request, because json is coming

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question