I am making an API using Lumen and Fractal, but I have an error
Method does not exist
when trying to log in. Can someone help me solve this? This is my controller:
public function login(Request $request, User $user) { if (!Auth::attempt(['email' => $request->email, 'password' => $request->password])) { return response()->json(['error' => 'email or password wrong'], 401); } $user = $user->find(Auth::user()->id); return fractal() ->item($user) ->transformWith(new UserTransformer) ->addMeta([ 'token' => $user->api_token, ]) ->toArray(); }
this is my mistake
(1/1) BadMethodCallException The attempt method does not exist. in Macroable.php (line 74)
source share