public function index()
 {
     if (Auth::check()) {
         if (Auth::user()->role->name === 'admin') {
             $threads = Thread::paginate(20);
         } else {
             $threads = Thread::departmentThreads(Auth::user()->department->id)->paginate(20);
         }
     } else {
         $threads = Thread::publicThreads()->paginate(20);
     }
     return view('threads.index', compact('threads'));
 }
Пример #2
0
 public function index()
 {
     $threads = Thread::paginate(10);
     return view('bbs.index')->with('threads', $threads);
 }