2018-01-01 06:51:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Models\Category;
|
|
|
|
use App\Models\Topic;
|
2018-06-02 10:21:53 +00:00
|
|
|
use App\Models\User;
|
2018-01-01 07:22:14 +00:00
|
|
|
use Illuminate\Http\Request;
|
2018-01-01 06:51:46 +00:00
|
|
|
|
|
|
|
class CategoriesController extends Controller
|
|
|
|
{
|
2018-06-02 10:21:53 +00:00
|
|
|
public function show(Category $category, Request $request, User $user)
|
2018-01-01 06:51:46 +00:00
|
|
|
{
|
2018-01-01 07:22:14 +00:00
|
|
|
$topics = Topic::where('category_id', $category->id)->withOrder($request->order)->with('user', 'category')->paginate();
|
2018-06-02 10:21:53 +00:00
|
|
|
$active_users = $user->getActiveUsers();
|
|
|
|
return view('topics.index', compact('topics', 'category', 'active_users'));
|
2018-01-01 06:51:46 +00:00
|
|
|
}
|
|
|
|
}
|