v0.10.9 - Added pagination onto guides, washing-reservations, events and news

This commit is contained in:
2020-08-19 09:54:26 +02:00
parent 4233a35e66
commit 6934c2d992
10 changed files with 169 additions and 5 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\News;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -14,9 +15,20 @@ class RootController extends Controller
}
public function index() {
if(auth()->user()->can('admin.panel.show'))
return Response::detect("root.index");
else
return view('app.root.index');
$perPage = 2;
if(auth()->user()->can('admin.panel.show')) {
if(Response::detect("root.index")->name() == "admin.root.index")
return Response::detect("root.index");
else {
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
return Response::detect("root.index", ["news" => $news]);
}
}
else {
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
return view('app.root.index', ["news" => $news]);
}
}
}