lundi 2 mai 2016

Use Laravel Spark's Controllers/Actions in my app's API

I'm up and running with Laravel Spark, but I'd like to pull some of the user auth methods (and later, some others) in to my API.

Spark's default registration method is a POST request to /register that calls Auth\RegisterController@register.

I would like registration to be POST request to api/v1/register but for the sake of simplicity, I'd like to simply call Spark's Auth\RegisterController@register method.

I did try simply copying the RegisterController from Spark in to my app's controller directory, but that didn't seem like an elegant solution and it didn't work anyway.

My app\Http\api.php contains the following group:

Route::group([
    'prefix' => 'api/v1',
    'middleware' => 'auth:api'
], function () {
    Route::get('register', 'Auth\RegisterController@showRegistrationForm');
    Route::post('register', 'Auth\RegisterController@register');
});

I'd love input and advice on the best way to pull in some of those Spark methods that I get out of the box.

Thanks in advance!



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

Aucun commentaire:

Enregistrer un commentaire