v0.10.18a - Various fixes

This commit is contained in:
frederikpyt
2020-08-31 13:20:49 +02:00
parent 56cdd63fbb
commit f29fe0180a
3 changed files with 24 additions and 8 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Event;
use App\News;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -17,10 +18,20 @@ class RootController extends Controller
public function index() {
$perPage = 5;
$newsCollection = News::query()->orderBy('id', 'desc')->paginate($perPage);
foreach ($newsCollection as $new)
{
if($new->type_id == 3)
if(Event::query()->where('id', '=', $new->arrangement_id)->first() == null)
$new->delete();
}
if(auth()->user()->can('admin.panel.show')) {
if(Response::detect("root.index")->name() == "admin.root.index")
return view("admin.root.index");
else {
$news = News::query()->orderBy('id', 'desc')->paginate($perPage);
return view("app.root.index", ["news" => $news]);
}