all(), [ 'email' => 'required', 'password' => 'required' ]); if ($validator->fails()) { return Response()->json([ "status" => "gagal", "message" => $validator->errors()->first(), null ], 200, [ ['Content-Type' => 'application/json;charset=UTF-8', 'Charset' => 'utf-8'] ]); } $data = [ "email" => $request->email, "password" => $request->password ]; if (Auth::attempt($data)) { return Response()->json([ "status" => "berhasil", "message" => "Login Berhasil", null ], 200, [ ['Content-Type' => 'application/json;charset=UTF-8', 'Charset' => 'utf-8'] ]); } return Response()->json([ "status" => "gagal", "message" => "Email atau Password Salah", null ], 200, [ ['Content-Type' => 'application/json;charset=UTF-8', 'Charset' => 'utf-8'] ]); } public function logout(Request $request) { Auth::logout(); return redirect('/'); } }