11<?php
22
3+ declare (strict_types=1 );
4+
35namespace TypiCMS \Modules \Events \Http \Controllers ;
46
57use Illuminate \Http \RedirectResponse ;
1416use TypiCMS \Modules \Events \Notifications \RegisteredToEvent ;
1517use TypiCMS \Modules \Events \Services \Calendar ;
1618
17- class PublicController extends BasePublicController
19+ final class PublicController extends BasePublicController
1820{
19- public function __construct (protected Calendar $ calendar ) {}
21+ public function __construct (
22+ protected Calendar $ calendar ,
23+ ) {}
2024
2125 public function index (): View
2226 {
@@ -27,8 +31,7 @@ public function index(): View
2731 ->where ('end_date ' , '>= ' , date ('Y-m-d ' ))
2832 ->paginate (config ('typicms.modules.events.per_page ' ));
2933
30- return view ('events::public.index ' )
31- ->with (['models ' => $ models ]);
34+ return view ('events::public.index ' , ['models ' => $ models ]);
3235 }
3336
3437 public function past (): View
@@ -40,8 +43,7 @@ public function past(): View
4043 ->where ('end_date ' , '< ' , date ('Y-m-d ' ))
4144 ->paginate (config ('typicms.modules.events.per_page ' ));
4245
43- return view ('events::public.past ' )
44- ->with (['models ' => $ models ]);
46+ return view ('events::public.past ' , ['models ' => $ models ]);
4547 }
4648
4749 public function show (string $ slug ): View
@@ -56,8 +58,7 @@ public function show(string $slug): View
5658 ->whereSlugIs ($ slug )
5759 ->firstOrFail ();
5860
59- return view ('events::public.show ' )
60- ->with (['model ' => $ model ]);
61+ return view ('events::public.show ' , ['model ' => $ model ]);
6162 }
6263
6364 public function showRegistrationForm (string $ slug ): View
@@ -68,8 +69,7 @@ public function showRegistrationForm(string $slug): View
6869 ->firstOrFail ();
6970 abort_if (!$ event ->registration_form || $ event ->end_date < date ('Y-m-d ' ), 404 );
7071
71- return view ('events::public.registration ' )
72- ->with (['event ' => $ event ]);
72+ return view ('events::public.registration ' , ['event ' => $ event ]);
7373 }
7474
7575 public function register (string $ slug , RegistrationFormRequest $ request ): RedirectResponse
@@ -91,14 +91,14 @@ public function register(string $slug, RegistrationFormRequest $request): Redire
9191 $ registration = Registration::query ()->create ($ data );
9292 (new Event ())->flushCache ();
9393
94- Notification::route ('mail ' , config ('typicms.webmaster_email ' ))
95- ->notify (new NewRegistrationToAnEvent ($ event , $ registration ));
94+ Notification::route ('mail ' , config ('typicms.webmaster_email ' ))->notify (new NewRegistrationToAnEvent (
95+ $ event ,
96+ $ registration ,
97+ ));
9698
97- Notification::route ('mail ' , $ data ['email ' ])
98- ->notify (new RegisteredToEvent ($ event , $ registration ));
99+ Notification::route ('mail ' , $ data ['email ' ])->notify (new RegisteredToEvent ($ event , $ registration ));
99100
100- return to_route (app ()->getLocale () . '::event-registered ' , $ event ->slug )
101- ->with ('success ' , true );
101+ return to_route (app ()->getLocale () . '::event-registered ' , $ event ->slug )->with ('success ' , true );
102102 }
103103
104104 public function registered (string $ slug ): RedirectResponse |View
@@ -108,7 +108,7 @@ public function registered(string $slug): RedirectResponse|View
108108 ->whereSlugIs ($ slug )
109109 ->firstOrFail ();
110110 if (session ('success ' )) {
111- return view ('events::public.registered ' )-> with ( ['event ' => $ event ]);
111+ return view ('events::public.registered ' , ['event ' => $ event ]);
112112 }
113113
114114 return redirect (url ('/ ' ));
0 commit comments