@@ -28,7 +28,7 @@ public function index(): View
2828 ->paginate (config ('typicms.modules.events.per_page ' ));
2929
3030 return view ('events::public.index ' )
31- ->with (compact ( 'models ' ) );
31+ ->with ([ 'models ' => $ models ] );
3232 }
3333
3434 public function past (): View
@@ -41,7 +41,7 @@ public function past(): View
4141 ->paginate (config ('typicms.modules.events.per_page ' ));
4242
4343 return view ('events::public.past ' )
44- ->with (compact ( 'models ' ) );
44+ ->with ([ 'models ' => $ models ] );
4545 }
4646
4747 public function show (string $ slug ): View
@@ -57,7 +57,7 @@ public function show(string $slug): View
5757 ->firstOrFail ();
5858
5959 return view ('events::public.show ' )
60- ->with (compact ( 'model ' ) );
60+ ->with ([ 'model ' => $ model ] );
6161 }
6262
6363 public function showRegistrationForm (string $ slug ): View
@@ -66,12 +66,10 @@ public function showRegistrationForm(string $slug): View
6666 ->published ()
6767 ->whereSlugIs ($ slug )
6868 ->firstOrFail ();
69- if (!$ event ->registration_form || $ event ->end_date < date ('Y-m-d ' )) {
70- abort (404 );
71- }
69+ abort_if (!$ event ->registration_form || $ event ->end_date < date ('Y-m-d ' ), 404 );
7270
7371 return view ('events::public.registration ' )
74- ->with (compact ( 'event ' ) );
72+ ->with ([ 'event ' => $ event ] );
7573 }
7674
7775 public function register (string $ slug , RegistrationFormRequest $ request ): RedirectResponse
@@ -80,9 +78,7 @@ public function register(string $slug, RegistrationFormRequest $request): Redire
8078 ->published ()
8179 ->whereSlugIs ($ slug )
8280 ->firstOrFail ();
83- if (!$ event ->registration_form || $ event ->end_date < date ('Y-m-d ' )) {
84- abort (404 );
85- }
81+ abort_if (!$ event ->registration_form || $ event ->end_date < date ('Y-m-d ' ), 404 );
8682 $ user = auth ()->user ();
8783 $ data = $ request ->validated ();
8884 $ data ['user_id ' ] = $ user ->id ;
@@ -112,7 +108,7 @@ public function registered(string $slug): RedirectResponse|View
112108 ->whereSlugIs ($ slug )
113109 ->firstOrFail ();
114110 if (session ('success ' )) {
115- return view ('events::public.registered ' )->with (compact ( 'event ' ) );
111+ return view ('events::public.registered ' )->with ([ 'event ' => $ event ] );
116112 }
117113
118114 return redirect (url ('/ ' ));
0 commit comments