很抱歉打扰你们,但我想知道是否有人可以帮助我。我在 Laravel 中的代码有点问题,习惯于从头开始工作,而不是使用框架。我使用了 Laravel Bootstrap Starter Site,并尝试添加其他页面,但路由并不完全协作。这是相当令人沮丧的。
控制器:app/controller/community/CommunityController.php
<?php
class CommunityController extends BaseController {
public function index() {
return View::make('community.index');
}
}
?>
风景
@extends('site.layouts.default')
{{-- Content --}}
@section('content')
@foreach ($posts as $post)
<div>
I'm just going to put this here...
</div>
@endforeach
{{ $posts->links() }}
@stop
最后,最后但同样重要的是,我的路线。
Route::get('community', array(
'uses' => 'CommunityController@index',
'as' => 'community.index'
));
现在,我有一种挥之不去的感觉,我错过了一些相当小的东西,但对于我的生活,我无法弄清楚。如果有人愿意解释我做错了什么,我将不胜感激。特别是因为我也可以防止将来发生这种问题。
亲切的问候,还没选好名字的用户
编辑:对不起,我忘了提这个。我删除了 public,所以我不知道这是否会影响任何事情。如果确实如此,再次抱歉忘记在开始时提及这一点。