2014-11-03 114 views
2

我在laravel有一个新手问题。我试图查询一个数据库。我已经修改了配置以包含我的数据库所需的凭据。现在,当我尝试查询我的数据库是这样的:Laravel:路由未找到错误

<?php 
/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| Here is where you can register all of the routes for an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the Closure to execute when that URI is requested. 
| 
*/ 
Route::get('/', function() 
{ 
    $topPages = DB::table('webmasters') -> get(); 
    return $topPages; 
}); 

我得到:致命错误:

Class 'Route' not found in /.../.../.../dashboard/app/routes.php on line 13.

我按照laracast视频访问数据库的信,可有人请告诉我我在这里失踪或做错了什么? 在此先感谢。

+1

你有没有命名空间您的应用程序?尝试'\ Route :: get()' – Laurence 2014-11-03 09:29:22

+0

就像我提到的,我在这里真的很绿。命名空间在这种情况下意味着什么?我在哪里把这个\ Route :: get() – 2014-11-03 09:32:02

+0

从'Route :: get('到'\ Route :: get(' – Laurence 2014-11-03 09:32:45

回答

1

可能的解决方案:

  1. 更新的应用程序由作曲家(composer update
  2. 检查文件权限