Saturday, May 19, 2018

Laravel get input data from POST request in a rest api - development

Laravel get input data from POST request in a rest api

i’m trying to get input data which i post them from rest api as an json format, but in laravel i can’t get them on controller and that return empty array of request

my api route:

Route::group(['prefix' => 'v1', 'namespace' => 'Apiv1'], function () {
    $this->post('login', 'ApiController@login');
});

and ApiController:

<?php

namespace AppHttpControllersApiv1;

use AppHttpControllersController;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;

class ApiController extends Controller
{

    public function login(Request $request)
    {
        dd($request->all());
    }
}

output:

[]

ScreenShot

Laravel get input data from POST request in a rest api



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-get-input-data-from-post-request-in-a-rest-api/
via Lzo Media

No comments:

Post a Comment