/** * Retourne un tableau avec les forums dans la catégorie * */ public function getForumsInCategory() { return Forum::where('parent_id', '=', $this->id)->get(); }
<th>On Todo List?</th> <th>Asymmetric?</th> <th>Time Limited?</th> <th>Player Specific?</th> <th>Allowed Characters</th> <th>Position</th> </thead> <tbody> <?php if ($category->name == "Trashed") { $collection = Forum::onlyTrashed()->get(); } else { if ($category->name == "Unassociated") { $collection = Forum::whereNull('category_id')->get(); } else { $collection = Forum::where('category_id', $category->id)->orderBy('position')->get(); } } ?> @foreach($collection as $forum) <tr> <td> <a href="/dashboard/storyteller/manage/forums/{{$forum->id}}/edit" data-tooltip title="Edit"> <i class="icon-pencil"></i> </a> <a href="/dashboard/storyteller/manage/forums/{{$forum->id}}/characters" data-tooltip title="Permitted Characters"> <i class="icon-users"></i> </a> @if($category->name == "Trashed") <a href="/dashboard/storyteller/manage/forums/{{$forum->id}}/restore" data-tooltip title="Restore"> <i class="icon-flash"></i>
/** * Affiche la page d'accueil du forum * */ public function index() { $categories = Forum::where('parent_id', '=', 0)->orderBy('position', 'ASC')->get(); return View::make('forum.index', array('categories' => $categories)); }
function markCategoryRead($id) { $user = Auth::user(); if ($user) { foreach (Forum::where('category_id', $id)->get() as $forum) { $forum->markForumRead($user->id); } return Redirect::to("/forums/"); } else { return Response::json(["success" => false, "message" => "Not logged in."]); } }