Vineet Kaushik Vineet Kaushik - 1 year ago 265
PHP Question

lumen NotFoundHttpException in RoutesRequests.php

I know this question has been asked before here. (Please clink on the link before you vote to close it under the duplicate tag.) But none of the solutions have worked for me.

I can access

without any errors. But when I try to use a get request to login I get this error:

in RoutesRequests.php (line 594)
at Application->handleDispatcherResponse(array(0))
in RoutesRequests.php (line 532)
at Application->Laravel\Lumen\Concerns\{closure}()
in RoutesRequests.php (line 781)
at Application->sendThroughPipeline(array(), object(Closure))
in RoutesRequests.php (line 534)
at Application->dispatch(null)
in RoutesRequests.php (line 475)
at Application->run()
in index.php (line 28)

index.php (line 28)
points to

Here is my code for the login form page:

<!DOCTYPE html>
<!-- <link rel="stylesheet" type="text/css" href="{{ url('../assets/css/main.css') }}"> -->
body {
background-color: #ffffff;

.banner {
margin: 100px auto;
text-align: center;
vertical-align: middle;
font-family: 'Open Sans', sans-serif;
font-size: 30px;
color: #333333;

.loginContainer {
margin: 50px auto;
vertical-align: middle;
background-color: #333333;

form {
margin: 0 auto;
padding: 50px;

form input {
display: block;
width: 300px;
margin: 0 auto;
margin-top: 5px;
padding: 5px;
font-size: 30px;

form button {
display: block;
width: 314px;
margin: 0 auto;
margin-top: 5px;
padding: 5px;
border-radius: 5px;
border: none;
background-color: #3366ff;
color: #ffffff;
font-size: 30px;
<link href="" rel="stylesheet">
<!-- <div class="navbar">
<li>About Me!</li>
</div> -->
<div class="banner">
<h1>Welcome to notes!</h1>
<h4>Add notes, to-do lists and more!</h4>
<div class="loginContainer">
<form class="signin" method="get" action="/login/">
<input type="email" id="inputEmail" placeholder="Email" required="" autofocus="">
<input type="password" id="inputPassword" placeholder="Password" required="">
<button type="submit">Sign in</button>

Here is the code for


| Application Routes
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.

$app->get('/', function () use ($app) {
return view('welcome');

$app->get('login/','[email protected]');
$app->post('todo/','[email protected]');
$app->get('todo/', '[email protected]');
$app->get('todo/{id}/', '[email protected]');
$app->put('todo/{id}/', '[email protected]');
$app->delete('todo/{id}/', '[email protected]');


Here is the


namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

use Illuminate\Support\Facades\Hash;

use Illuminate\Http\Request;

use App\Users;

class UsersController extends Controller


  public function __construct()


//        $this->middleware('auth:api');


    * Display a listing of the resource.
    * @return \Illuminate\Http\Response

   public function authenticate(Request $request)


       $this->validate($request, [

       'email' => 'required',

       'password' => 'required'


      $user = Users::where('email', $request->input('email'))->first();

     if(Hash::check($request->input('password'), $user->password)){

          $apikey = base64_encode(str_random(40));

          Users::where('email', $request->input('email'))->update(['api_key' => "$apikey"]);;

          return response()->json(['status' => 'success','api_key' => $apikey]);


          return response()->json(['status' => 'fail'],401);





Answer Source

Route first argument is trimmed with '/'

Fix to form action: /login/ -> /login

<form class="signin" method="get" action="/login">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download