diff --git a/app/Http/Controllers/ReceptionScreenController.php b/app/Http/Controllers/ReceptionScreenController.php index cb29ed1..6edc843 100644 --- a/app/Http/Controllers/ReceptionScreenController.php +++ b/app/Http/Controllers/ReceptionScreenController.php @@ -12,6 +12,10 @@ use Illuminate\Support\Facades\Auth; class ReceptionScreenController extends Controller { + public function __construct() + { + $this->middleware('auth'); + } public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application { $receptionScreens = ReceptionScreen::all()->sortBy('position'); @@ -20,9 +24,8 @@ class ReceptionScreenController extends Controller public function create(): View { - if (Auth::guest()) { - abort(403); - } + abort_if(Auth::guest(), 403); + $receptionScreens = ReceptionScreen::all()->sortBy('position'); return view('admin-reception-screen.create', compact('receptionScreens')); } @@ -39,6 +42,8 @@ class ReceptionScreenController extends Controller } public function edit($id) { + abort_if(Auth::guest(), 403); + $receptionScreen = new ReceptionScreen(); $currentReceptionScreen = $receptionScreen->find($id); $receptionScreens = $receptionScreen->all()->sortBy('position');