0
votes

I'm new to Laravel and am building a simple web application. I'll show what code I'm using next and then I'll explain my problem.

Here's how my form starts in the view login.blade.php:

<?php
        //build the form
        echo Form::open(array('action' => 'AuthenticationController@authenticateUser'));

And here's what the route for the home page:

  Route::get('/', function() {
        return View::make('login', array('page_title' => 'Log in to MANGER'));
 });

Finally, here's the authentication controller (for now it's a simple redirect to simulate login):

class AuthenticationController extends BaseController {

    public function authenticateUser()
    {
        //retrive from database
        return View::make('hr', array('page_title' => 'MANGER Login'));
    }

}

My problem is, I'm getting an error on login.blade.php. saying: Route [AuthenticationController@authenticateUser] not defined. (View: /opt/lampp/htdocs/manger/app/views/login.blade.php)

How is the error about a route when I've defined a controller instead? And also, how can this be fixed? Please excuse any noob errors and thanks a lot in advance! :-)

1

1 Answers

0
votes

You still need to define your route like this:

Route::post('authenticate', ['uses' => 'AuthenticationController@authenticateUser']);

Otherwise it won't know what method to use, or the url to create.