Mark Kasson
Mark Kasson

Reputation: 1710

Laravel Newbie: model Class Not Found in routes.php

Creating my first model with Laravel and its stored at app/models/Login.php. It is:

class Login extends Eloquent {
  public $timestamps = false;
}

In a Route in routes.php I am getting a Class 'Login' not found on the line $logins = Login::all();

I have run composer dump-auto in the root of the application (above app) and confirmed that the composer.json file contains "app/models", in the autoload classmap.

Thanks!

EDIT Adding the Route (never mind that it doesn't actually use num yet):

Route::get('/logins/last/{num}', function($num)
{
$logins = Login::all();
return View::make ('logins.last.index')
  ->with('logins', $logins)
  ->with('num', $num);
})->where('num', '[0-9]+'
);

Upvotes: 1

Views: 716

Answers (1)

Razor
Razor

Reputation: 9835

Wrap you code with <?php and ?> tags, which tell PHP to start and stop interpreting the code.

Upvotes: 1

Related Questions