laravel-learn-bbs/app/Http/Controllers/CategoriesController.php
2018-06-02 21:48:16 +08:00

21 lines
618 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Link;
use App\Models\Topic;
use App\Models\User;
use Illuminate\Http\Request;
class CategoriesController extends Controller
{
public function show(Category $category, Request $request, User $user, Link $link)
{
$topics = Topic::where('category_id', $category->id)->withOrder($request->order)->with('user', 'category')->paginate();
$links = $link->getAllCached();
$active_users = $user->getActiveUsers();
return view('topics.index', compact('topics', 'category', 'active_users', 'links'));
}
}