baig772 baig772 - 8 months ago 58
reST (reStructuredText) Question

Write web services with existing Laravel Controllers

I have a project in

Laravel 5.2
and now I have to make the
for that. I tried to hit the
via postman as a post request with the parameters but it returns me the
in return. I have used Laravel's auth scaffolding for the authorization.
I am unable to find
function in my project.
I have separated the routes but how can I change the existing functions for the API?

Route::group(array('prefix' => 'api/v1'), function()
Route::post('login', 'AuthController@postLogin');


Here is the postLogin that returns the json rather than the html code.

public function authenticate()
    if (Auth::attempt(['email' => $email, 'password' => $password])) {
        // Authentication passed...
        //return redirect()->intended('dashboard');
        return response()->json(['status' => 1]);

If you have any trouble, let me know.