Jonh Doe
Jonh Doe

Reputation: 761

Defined controller does not exist in Laravel 5

I defined a controller LoginController but I am having this error?

ReflectionException in Route.php line 264: Class App\Http\Controllers\LoginController does not exist

class LoginController extends Controller {

  // Display the login form
  public function showLogin()
  {
    return View::make('login');
  }

  // Process submission of the login form by verifying user’s credentials
  public function processLogin()
  {
    $username = Input::get('username');
    $password = Input::get('password');
    if ($username === 'prince' && $password === 'c@spiAN') {
      return 'Access granted!';
    } else {
      return 'Access denied! Wrong username or password.';
    }
  }
}

Upvotes: 1

Views: 1691

Answers (2)

Jonh Doe
Jonh Doe

Reputation: 761

Reinstalling laravel fixed the error without even adding anything.

Upvotes: 0

John Roca
John Roca

Reputation: 1234

<?php namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\User;

class LoginController extends Controller {
// Display the login form
public function showLogin()
{
  return View::make('login');
}

// Process submission of the login form by verifying user’s credentials
public function processLogin()
{
  $username = Input::get('username');
  $password = Input::get('password');
  if ($username === 'prince' && $password === 'c@spiAN') {
    return 'Access granted!';
  } else {
  return 'Access denied! Wrong username or password.';
  }
 }
}

Upvotes: 3

Related Questions