Laravel 4 - 在此服务器上找不到请求的资源/ painel

时间:2014-04-24 13:34:59

标签: php laravel-4

键入localhost:8000/painel时出现以下错误:

  

在此服务器上找不到请求的资源/ painel。

我在其他任何计算机上都遇到了同样的错误。在下面,按照路线:

// ROTA DE POSTS
Route::get('/', array('as' => 'index', 'uses' => 'site\PostsController@index'));

// route to show the login form
Route::get('/{slug}', array('as' => 'post.show', 'uses' => 'site\PostsController@show'));
Route::get('painel', array('uses' => 'painel\PainelLoginController@showLogin'));
Route::post('painel', array('uses' => 'painel\PainelLoginController@authenticate'));
Route::get('logout', array('as' => 'logout', 'uses' => 'painel\PainelLoginController@doLogout'));

Route::get('/p/{slug}', array('as' => 'pagina.show', 'uses' => 'site\PaginasController@show'));

Route::group(array('prefix' => 'painel', 'before' => 'auth'), function () {

    // ROTA DE POSTS NO ADMIN
    Route::get('/posts', array('as' => 'painel.post.index', 'uses' => 'painel\PainelPostsController@index'));
    Route::post('/post/store/', 'painel\PainelPostsController@store');
    Route::post('/post/{slug}/update/', 'painel\PainelPostsController@update');
    Route::get('/post/novo/', array('as' => 'painel.post.novo', 'uses' => 'painel\PainelPostsController@create'));
    Route::get('/post/{slug}/editar/', 'painel\PainelPostsController@edit');
    Route::get('/post/{slug}/deletar/', 'painel\PainelPostsController@destroy');

    // ROTA DE PÁGINAS NO ADMIN
    Route::get('/paginas', array('as' => 'painel.pagina.index', 'uses' => 'painel\PainelPaginasController@index'));
    Route::post('/pagina/store/', 'painel\PainelPaginasController@store');
    Route::post('/pagina/{slug}/update/', 'painel\PainelPaginasController@update');
    Route::get('/pagina/novo/', array('as' => 'painel.pagina.novo', 'uses' => 'painel\PainelPaginasController@create'));
    Route::get('/pagina/{slug}/editar/', array('as' => 'painel.pagina.edit', 'uses' => 'painel\PainelPaginasController@edit'));
    Route::get('/pagina/{slug}/deletar/', 'painel\PainelPaginasController@destroy');
});

2 个答案:

答案 0 :(得分:0)

在路线减速之前加上斜线?

Route :: get('/ painel',array('uses'=>'painel \ PainelLoginController @ showLogin'));

答案 1 :(得分:0)

尝试使用

Route::get('painel', array('uses' => 'PainelLoginController@showLogin'));

没有您的目录painel\(我假设它是您的目录)。 laravel自动检查该类 PainelLoginController 并知道它所在的位置。这是通过自动加载器完成的。你可以在/vendor/composer/autoload_classmap.php下看一眼。