0
votes

Hi I got problem with my Laravel Rest-API apps, whenever i access localhost:8000/api/login in my Postman its say

(1/1) ReflectionException Class signature does not exist

This is my artisan route:list for api/login

POST | api/login | | App\Http\Controllers\Api\UserController@login | api

This is my api route

<?php

use Illuminate\Http\Request;

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::post('oauth/token', '\Laravel\Passport\Http\Controllers\AccessTokenController@issueToken');


Route::group(['namespace' => 'Api'], function () {
    Route::post('/login', 'UserController@login');
});

This is my UserController inside Api folder

<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use App\User;
use Response;

class UserController extends Controller
{
    public function __construct()
    {
        $this->content = array();
    }

    public function login()
    {
        if (Auth::attempt(['email' => request('email'), 'password' => request('password')])) {
            $user = Auth::user();
            $this->content['token'] =  $user->createToken('Pizza App')->accessToken;
            $status = 200;
        } else {
            $this->content['error'] = "Unauthorised";
             $status = 401;
        }

        return response()->json($this->content, $status);    
    }
}

please help me, if I trying to test my Rest-Api in postman, its keep saying

(1/1) ReflectionException Class signature does not exist

1

1 Answers