From 4680c5c7c8abc9276f8649a2f423775fee2dfa6b Mon Sep 17 00:00:00 2001 From: TheR00st3r Date: Wed, 13 Nov 2024 22:42:42 +0100 Subject: [PATCH 1/3] Fix View With Variables ->with([A-Za-z])([^(]*)\(([A-Za-z]) ->with('\L$1$2', $3 --- .../Controllers/Admin/AdminController.php | 18 ++-- .../Admin/AppearanceController.php | 4 +- .../Controllers/Admin/CreditController.php | 4 +- .../Admin/Events/EventsController.php | 12 +-- .../Admin/Events/VenuesController.php | 2 +- .../Controllers/Admin/GalleryController.php | 6 +- .../Admin/GameTemplatesController.php | 10 +-- .../Controllers/Admin/GamesController.php | 2 +- .../Http/Controllers/Admin/HelpController.php | 12 +-- .../Controllers/Admin/MailingController.php | 4 +- .../Admin/MatchMakingController.php | 12 +-- .../Http/Controllers/Admin/NewsController.php | 6 +- .../Controllers/Admin/OrdersController.php | 2 +- .../Controllers/Admin/PollsController.php | 2 +- .../Controllers/Admin/PurchasesController.php | 8 +- .../Controllers/Admin/SettingsController.php | 88 +++++++++---------- .../Http/Controllers/Admin/ShopController.php | 10 +-- .../Controllers/Admin/UsersController.php | 8 +- .../Http/Controllers/Auth/AuthController.php | 2 +- .../Controllers/Events/EventsController.php | 6 +- src/app/Http/Controllers/HomeController.php | 18 ++-- .../Controllers/MatchMakingController.php | 2 +- src/app/Http/Controllers/NewsController.php | 2 +- .../Http/Controllers/PaymentsController.php | 18 ++-- src/app/Http/Controllers/ShopController.php | 16 ++-- 25 files changed, 137 insertions(+), 137 deletions(-) diff --git a/src/app/Http/Controllers/Admin/AdminController.php b/src/app/Http/Controllers/Admin/AdminController.php index 9383aeaa..6d4f8848 100644 --- a/src/app/Http/Controllers/Admin/AdminController.php +++ b/src/app/Http/Controllers/Admin/AdminController.php @@ -81,20 +81,20 @@ public function index() ->withComments($comments) ->withTickets($tickets) ->withActivePolls($activePolls) - ->withShopEnabled(Settings::isShopEnabled()) - ->withGalleryEnabled(Settings::isGalleryEnabled()) - ->withHelpEnabled(Settings::isHelpEnabled()) - ->withCreditEnabled(Settings::isCreditEnabled()) - ->withSupportedLoginMethods(Settings::getSupportedLoginMethods()) - ->withActiveLoginMethods(Settings::getLoginMethods()) - ->withSupportedPaymentGateways(Settings::getSupportedPaymentGateways()) - ->withActivePaymentGateways(Settings::getPaymentGateways()) + ->with('shopEnabled', Settings::isShopEnabled()) + ->with('galleryEnabled', Settings::isGalleryEnabled()) + ->with('helpEnabled', Settings::isHelpEnabled()) + ->with('creditEnabled', Settings::isCreditEnabled()) + ->with('supportedLoginMethods', Settings::getSupportedLoginMethods()) + ->with('activeLoginMethods', Settings::getLoginMethods()) + ->with('supportedPaymentGateways', Settings::getSupportedPaymentGateways()) + ->with('activePaymentGateways', Settings::getPaymentGateways()) ->withFacebookCallback($facebookCallback) ->withUserLastLoggedIn($userLastLoggedIn) ->withUserCount($users->count()) ->withUserLoginMethodCount($userLoginMethodCount) ->withParticipantCount($participantCount) - ->withNextEvent(Helpers::getNextEventName()) + ->with('nextEvent', Helpers::getNextEventName()) ->withTournamentCount($tournamentCount) ->withTournamentParticipantCount($tournamentParticipantCount) ->withOrderBreakdown($orderBreakdown) diff --git a/src/app/Http/Controllers/Admin/AppearanceController.php b/src/app/Http/Controllers/Admin/AppearanceController.php index 4b1dcd99..fc41c605 100644 --- a/src/app/Http/Controllers/Admin/AppearanceController.php +++ b/src/app/Http/Controllers/Admin/AppearanceController.php @@ -42,8 +42,8 @@ public function index() return false !== stristr($item->key, 'color_header'); }); return view('admin.settings.appearance') - ->withSliderImages(SliderImage::getImages('frontpage')) - ->withUserOverrideCss(Appearance::getCssOverride()) + ->with('sliderImages', SliderImage::getImages('frontpage')) + ->with('userOverrideCss', Appearance::getCssOverride()) ->withCssVariables($sortedCssVariables); } diff --git a/src/app/Http/Controllers/Admin/CreditController.php b/src/app/Http/Controllers/Admin/CreditController.php index 89ba7847..698ed5c1 100644 --- a/src/app/Http/Controllers/Admin/CreditController.php +++ b/src/app/Http/Controllers/Admin/CreditController.php @@ -31,8 +31,8 @@ public function index() $selectallusers[$user->id] = $user->username; } return view('admin.credit.index') - ->withIsCreditEnabled(Settings::isCreditEnabled()) - ->withCreditLogs(CreditLog::paginate(10, ['*'], 'cl')) + ->with('isCreditEnabled', Settings::isCreditEnabled()) + ->with('creditLogs', CreditLog::paginate(10, ['*'], 'cl')) ->withUsers($selectallusers); } diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index e50131cf..969798da 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -30,9 +30,9 @@ class EventsController extends Controller public function index() { return view('admin.events.index') - ->withUser(Auth::user()) - ->withEvents(Event::withoutGlobalScopes()->paginate(10)) - ->withEventTags(Helpers::getEventulaEventTags()); + ->with('user', Auth::user()) + ->with('events', Event::withoutGlobalScopes()->paginate(10)) + ->with('eventTags', Helpers::getEventulaEventTags()); } /** @@ -43,7 +43,7 @@ public function index() public function show(Event $event) { return view('admin.events.show') - ->withUser(Auth::user()) + ->with('user', Auth::user()) ->withEvent($event) ->withAnnouncements($event->announcements()->paginate(5, ['*'], 'an')) ->withParticipants($event->eventParticipants()->paginate(10, ['*'], 'ep')); @@ -265,8 +265,8 @@ public function freeGift(Request $request, Event $event) $participant->staff_free_assigned_by = Auth::id(); $participant->purchase_id = $purchase->id; $participant->generateQRCode(); - - + + if (!$participant->save()) { Session::flash('alert-danger', 'Could not add Gift!'); return Redirect::to('admin/events/' . $event->slug . '/tickets'); diff --git a/src/app/Http/Controllers/Admin/Events/VenuesController.php b/src/app/Http/Controllers/Admin/Events/VenuesController.php index 79d1b413..838e5ba0 100644 --- a/src/app/Http/Controllers/Admin/Events/VenuesController.php +++ b/src/app/Http/Controllers/Admin/Events/VenuesController.php @@ -28,7 +28,7 @@ class VenuesController extends Controller public function index() { return view('admin.events.venues.index') - ->withVenues(EventVenue::paginate(10)) + ->with('venues', EventVenue::paginate(10)) ; } diff --git a/src/app/Http/Controllers/Admin/GalleryController.php b/src/app/Http/Controllers/Admin/GalleryController.php index 2f33cd49..fc502649 100644 --- a/src/app/Http/Controllers/Admin/GalleryController.php +++ b/src/app/Http/Controllers/Admin/GalleryController.php @@ -32,8 +32,8 @@ class GalleryController extends Controller public function index() { return view('admin.gallery.index') - ->withAlbums(GalleryAlbum::paginate(20)) - ->withisGalleryEnabled(Settings::isGalleryEnabled()) + ->with('albums', GalleryAlbum::paginate(20)) + ->with('isGalleryEnabled', Settings::isGalleryEnabled()) ; } @@ -46,7 +46,7 @@ public function show(GalleryAlbum $album) return view('admin.gallery.show') ->withAlbum($album) ->withImages($album->images()->paginate(10)) - ->withisGalleryEnabled(Settings::isGalleryEnabled()) + ->with('isGalleryEnabled', Settings::isGalleryEnabled()) ; } diff --git a/src/app/Http/Controllers/Admin/GameTemplatesController.php b/src/app/Http/Controllers/Admin/GameTemplatesController.php index 8a74fe32..70897e65 100644 --- a/src/app/Http/Controllers/Admin/GameTemplatesController.php +++ b/src/app/Http/Controllers/Admin/GameTemplatesController.php @@ -32,7 +32,7 @@ class GameTemplatesController extends Controller public function index() { return view('admin.games.gametemplates.index') - ->withGameTemplates(Helpers::getGameTemplates()); + ->with('gameTemplates', Helpers::getGameTemplates()); } /** @@ -48,17 +48,17 @@ public function deploy(Request $request) } try { - DB::beginTransaction(); + DB::beginTransaction(); Artisan::call('db:seed', ['class'=> $request->gameTemplateClass, '--force' => true]); $artisanOutput = Artisan::output(); - + if (in_array("Error", str_split($artisanOutput, 5))) { throw new Exception($artisanOutput); } - + DB::commit(); - + Session::flash('alert-success', 'Game template successfully deployed!'); return Redirect::to('admin/games/gametemplates'); diff --git a/src/app/Http/Controllers/Admin/GamesController.php b/src/app/Http/Controllers/Admin/GamesController.php index 1a46858e..0ce66e9e 100644 --- a/src/app/Http/Controllers/Admin/GamesController.php +++ b/src/app/Http/Controllers/Admin/GamesController.php @@ -26,7 +26,7 @@ class GamesController extends Controller public function index() { return view('admin.games.index') - ->withGames(Game::paginate(20)); + ->with('games', Game::paginate(20)); } /** diff --git a/src/app/Http/Controllers/Admin/HelpController.php b/src/app/Http/Controllers/Admin/HelpController.php index da07ed38..7e872c63 100644 --- a/src/app/Http/Controllers/Admin/HelpController.php +++ b/src/app/Http/Controllers/Admin/HelpController.php @@ -33,8 +33,8 @@ class HelpController extends Controller public function index() { return view('admin.help.index') - ->withHelpCategorys(HelpCategory::paginate(20)) - ->withisHelpEnabled(Settings::isHelpEnabled()) + ->with('helpCategorys', HelpCategory::paginate(20)) + ->with('isHelpEnabled', Settings::isHelpEnabled()) ; } @@ -47,7 +47,7 @@ public function show(HelpCategory $helpCategory) return view('admin.help.show') ->withHelpCategory($helpCategory) ->withEntrys($helpCategory->entrys()->paginate(10)) - ->withisHelpEnabled(Settings::isHelpEnabled()) + ->with('isHelpEnabled', Settings::isHelpEnabled()) ; } @@ -263,8 +263,8 @@ public function uploadFiles(HelpCategory $helpCategory, HelpCategoryEntry $entry if ($attachment->save()){ $uploadcount++; - } - + } + } if ($uploadcount != $fileCount) { Session::flash('alert-danger', 'Upload unsuccessful check attachments!'); @@ -285,7 +285,7 @@ public function uploadFiles(HelpCategory $helpCategory, HelpCategoryEntry $entry public function destroyFile(HelpCategory $helpCategory, HelpCategoryEntry $entry, HelpCategoryEntryAttachment $attachment) { $destinationPathFile = '/attachments/help/' . $entry->id . '/' . $attachment->display_name; - + if (!$attachment->delete()) { Session::flash('alert-danger', 'Cannot delete Attachment!'); return Redirect::back(); diff --git a/src/app/Http/Controllers/Admin/MailingController.php b/src/app/Http/Controllers/Admin/MailingController.php index f9e293d1..9ec05371 100644 --- a/src/app/Http/Controllers/Admin/MailingController.php +++ b/src/app/Http/Controllers/Admin/MailingController.php @@ -44,8 +44,8 @@ public function index() foreach ($userswithmail as $user) { $selectallusers[$user->id] = $user->username; } - return view('admin.mailing.index')->withMailTemplates(MailTemplate::all()) - ->withMailVariables(EventulaMailingMail::getVariables()) + return view('admin.mailing.index')->with('mailTemplates', MailTemplate::all()) + ->with('mailVariables', EventulaMailingMail::getVariables()) ->withUsersWithMail($selectallusers) ->withNextEvent($nextevent) ->withUser($user); diff --git a/src/app/Http/Controllers/Admin/MatchMakingController.php b/src/app/Http/Controllers/Admin/MatchMakingController.php index 2d944554..4eb246f8 100644 --- a/src/app/Http/Controllers/Admin/MatchMakingController.php +++ b/src/app/Http/Controllers/Admin/MatchMakingController.php @@ -51,7 +51,7 @@ public function index() ->withMatches($matches) ->withPendingMatches($pendingmatches) ->withLiveMatches($livematches) - ->withisMatchMakingEnabled(Settings::isMatchMakingEnabled()) + ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) ->withUsers($selectallusers); } @@ -151,7 +151,7 @@ public function store(Request $request) Session::flash('alert-danger', "you cannot create the match with the selected team 1 owner, because the nessecary third party account link on the user is missing"); return Redirect::back(); } - + } $game_id = $request->game_id; @@ -511,7 +511,7 @@ public function deleteteam(MatchMaking $match, MatchMakingTeam $team, Request $ public function addusertomatch(MatchMaking $match, MatchMakingTeam $team, Request $request) { - + $rules = [ @@ -536,7 +536,7 @@ public function addusertomatch(MatchMaking $match, MatchMakingTeam $team, Reques } - + if ($match->status == "LIVE" || $match->status == "COMPLETE" || $match->status == "WAITFORPLAYERS" || $match->status == "PENDING") { @@ -612,12 +612,12 @@ public function destroy(MatchMaking $match) if(!$matchReplay->deleteReplayFile()) { Session::flash('alert-danger', 'Cannot delete Replay files!'); - return Redirect::back(); + return Redirect::back(); } if(!$matchReplay->delete()) { Session::flash('alert-danger', 'Cannot delete Replays!'); - return Redirect::back(); + return Redirect::back(); } } if (!$match->players()->delete()) { diff --git a/src/app/Http/Controllers/Admin/NewsController.php b/src/app/Http/Controllers/Admin/NewsController.php index 3f8f51fc..5e362295 100644 --- a/src/app/Http/Controllers/Admin/NewsController.php +++ b/src/app/Http/Controllers/Admin/NewsController.php @@ -33,14 +33,14 @@ class NewsController extends Controller public function index() { return view('admin.news.index') - ->withNewsArticles(NewsArticle::paginate(10)) - ->withFacebookLinked(Facebook::isLinked()) + ->with('newsArticles', NewsArticle::paginate(10)) + ->with('facebookLinked', Facebook::isLinked()) ->withCommentsToApprove( NewsComment::where([['approved', '=', false], ['reviewed', '=', false]]) ->get() ->reverse() ) - ->withCommentsReported(NewsCommentReport::where('reviewed', false)->get()->reverse()) + ->with('commentsReported', NewsCommentReport::where('reviewed', false)->get()->reverse()) ; } diff --git a/src/app/Http/Controllers/Admin/OrdersController.php b/src/app/Http/Controllers/Admin/OrdersController.php index 5f06b2a0..6ab731fc 100644 --- a/src/app/Http/Controllers/Admin/OrdersController.php +++ b/src/app/Http/Controllers/Admin/OrdersController.php @@ -25,7 +25,7 @@ class OrdersController extends Controller */ public function index() { - return view('admin.orders.index')->withOrders(ShopOrder::orderBy('created_at', 'desc')->paginate(10)); + return view('admin.orders.index')->with('orders', ShopOrder::orderBy('created_at', 'desc')->paginate(10)); } /** diff --git a/src/app/Http/Controllers/Admin/PollsController.php b/src/app/Http/Controllers/Admin/PollsController.php index d4fc8213..4dbf3df7 100644 --- a/src/app/Http/Controllers/Admin/PollsController.php +++ b/src/app/Http/Controllers/Admin/PollsController.php @@ -27,7 +27,7 @@ class PollsController extends Controller public function index() { return view('admin.polls.index') - ->withPolls(Poll::paginate(10)) + ->with('polls', Poll::paginate(10)) ; } diff --git a/src/app/Http/Controllers/Admin/PurchasesController.php b/src/app/Http/Controllers/Admin/PurchasesController.php index 18ec9928..a4f5b769 100644 --- a/src/app/Http/Controllers/Admin/PurchasesController.php +++ b/src/app/Http/Controllers/Admin/PurchasesController.php @@ -26,7 +26,7 @@ class PurchasesController extends Controller public function index() { return view('admin.purchases.index') - ->withPurchases(Helpers::paginate(Purchase::get()->sortByDesc('created_at'), 20)); + ->with('purchases', Helpers::paginate(Purchase::get()->sortByDesc('created_at'), 20)); } /** @@ -36,7 +36,7 @@ public function index() public function showShop() { return view('admin.purchases.index') - ->withPurchases(Helpers::paginate(Purchase::has('order')->get()->sortByDesc('created_at'), 20)); + ->with('purchases', Helpers::paginate(Purchase::has('order')->get()->sortByDesc('created_at'), 20)); } /** @@ -46,7 +46,7 @@ public function showShop() public function showEvent() { return view('admin.purchases.index') - ->withPurchases(Helpers::paginate(Purchase::has('participants')->get()->sortByDesc('created_at'), 20)); + ->with('purchases', Helpers::paginate(Purchase::has('participants')->get()->sortByDesc('created_at'), 20)); } /** @@ -60,7 +60,7 @@ public function showRevoked() Helpers::paginate( Purchase::whereHas('participants', function ($query) { $query->where('revoked', '=', 1); - })->get()->sortByDesc('created_at'), + })->get()->sortByDesc('created_at'), 20 ) ); diff --git a/src/app/Http/Controllers/Admin/SettingsController.php b/src/app/Http/Controllers/Admin/SettingsController.php index a8fcff6c..f4de7a8a 100644 --- a/src/app/Http/Controllers/Admin/SettingsController.php +++ b/src/app/Http/Controllers/Admin/SettingsController.php @@ -44,16 +44,16 @@ public function index() $facebookCallback = Facebook::getLoginUrl(); } return view('admin.settings.index') - ->withSettings(Setting::all()) - ->withIsShopEnabled(Settings::isShopEnabled()) - ->withisGalleryEnabled(Settings::isGalleryEnabled()) - ->withisHelpEnabled(Settings::isHelpEnabled()) - ->withisMatchMakingEnabled(Settings::isMatchMakingEnabled()) - ->withIsCreditEnabled(Settings::isCreditEnabled()) + ->with('settings', Setting::all()) + ->with('isShopEnabled', Settings::isShopEnabled()) + ->with('isGalleryEnabled', Settings::isGalleryEnabled()) + ->with('isHelpEnabled', Settings::isHelpEnabled()) + ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) + ->with('isCreditEnabled', Settings::isCreditEnabled()) ->withFacebookCallback($facebookCallback) - ->withFacebookIsLinked(Facebook::isLinked()) - ->withSupportedLoginMethods(Settings::getSupportedLoginMethods()) - ->withActiveLoginMethods(Settings::getLoginMethods()); + ->with('facebookIsLinked', Facebook::isLinked()) + ->with('supportedLoginMethods', Settings::getSupportedLoginMethods()) + ->with('activeLoginMethods', Settings::getLoginMethods()); } /** @@ -63,7 +63,7 @@ public function index() public function showOrg() { return view('admin.settings.org') - ->withSettings(Setting::all()); + ->with('settings', Setting::all()); } /** @@ -74,10 +74,10 @@ public function showPayments() { return view('admin.settings.payments') - ->withSupportedPaymentGateways(Settings::getSupportedPaymentGateways()) - ->withActivePaymentGateways(Settings::getPaymentGateways()) - ->withIsCreditEnabled(Settings::isCreditEnabled()) - ->withIsShopEnabled(Settings::isShopEnabled()); + ->with('supportedPaymentGateways', Settings::getSupportedPaymentGateways()) + ->with('activePaymentGateways', Settings::getPaymentGateways()) + ->with('isCreditEnabled', Settings::isCreditEnabled()) + ->with('isShopEnabled', Settings::isShopEnabled()); } /** @@ -88,23 +88,23 @@ public function showSystems() { return view('admin.settings.systems') - ->withIsSystemsMatchMakingPublicuseEnabled(Settings::isSystemsMatchMakingPublicuseEnabled()) - ->withMaxOpenPerUser(Settings::getSystemsMatchMakingMaxopenperuser()) - ->withIsMatchMakingEnabled(Settings::isMatchMakingEnabled()) - ->withIsCreditEnabled(Settings::isCreditEnabled()) - ->withCreditAwardTournamentParticipation(Settings::getCreditTournamentParticipation()) - ->withCreditAwardTournamentFirst(Settings::getCreditTournamentFirst()) - ->withCreditAwardTournamentSecond(Settings::getCreditTournamentSecond()) - ->withCreditAwardTournamentThird(Settings::getCreditTournamentThird()) - ->withCreditAwardRegistrationEvent(Settings::getCreditRegistrationEvent()) - ->withCreditAwardRegistrationSite(Settings::getCreditRegistrationSite()) + ->with('isSystemsMatchMakingPublicuseEnabled', Settings::isSystemsMatchMakingPublicuseEnabled()) + ->with('maxOpenPerUser', Settings::getSystemsMatchMakingMaxopenperuser()) + ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) + ->with('isCreditEnabled', Settings::isCreditEnabled()) + ->with('creditAwardTournamentParticipation', Settings::getCreditTournamentParticipation()) + ->with('creditAwardTournamentFirst', Settings::getCreditTournamentFirst()) + ->with('creditAwardTournamentSecond', Settings::getCreditTournamentSecond()) + ->with('creditAwardTournamentThird', Settings::getCreditTournamentThird()) + ->with('creditAwardRegistrationEvent', Settings::getCreditRegistrationEvent()) + ->with('creditAwardRegistrationSite', Settings::getCreditRegistrationSite()) - ->withIsShopEnabled(Settings::isShopEnabled()) - ->withShopWelcomeMessage(Settings::getShopWelcomeMessage()) - ->withShopStatus(Settings::getShopStatus()) - ->withShopClosedMessage(Settings::getShopClosedMessage()); + ->with('isShopEnabled', Settings::isShopEnabled()) + ->with('shopWelcomeMessage', Settings::getShopWelcomeMessage()) + ->with('shopStatus', Settings::getShopStatus()) + ->with('shopClosedMessage', Settings::getShopClosedMessage()); } /** @@ -115,11 +115,11 @@ public function showAuth() { return view('admin.settings.auth') - ->withSupportedLoginMethods(Settings::getSupportedLoginMethods()) - ->withActiveLoginMethods(Settings::getLoginMethods()) - ->withIsAuthAllowEmailChangeEnabled(Settings::isAuthAllowEmailChangeEnabled()) - ->withIsAuthSteamRequireEmailEnabled(Settings::isAuthSteamRequireEmailEnabled()) - ->withIsAuthRequirePhonenumberEnabled(Settings::isAuthRequirePhonenumberEnabled()); + ->with('supportedLoginMethods', Settings::getSupportedLoginMethods()) + ->with('activeLoginMethods', Settings::getLoginMethods()) + ->with('isAuthAllowEmailChangeEnabled', Settings::isAuthAllowEmailChangeEnabled()) + ->with('isAuthSteamRequireEmailEnabled', Settings::isAuthSteamRequireEmailEnabled()) + ->with('isAuthRequirePhonenumberEnabled', Settings::isAuthRequirePhonenumberEnabled()); } /** @@ -129,17 +129,17 @@ public function showAuth() public function showApi() { return view('admin.settings.api') - ->withApiKeys(ApiKey::all()) - ->withPaypalUsername(ApiKey::where('key', 'paypal_username')->first()->value) - ->withPaypalPassword(ApiKey::where('key', 'paypal_password')->first()->value) - ->withPaypalSignature(ApiKey::where('key', 'paypal_signature')->first()->value) - ->withStripePublicKey(ApiKey::where('key', 'stripe_public_key')->first()->value) - ->withStripeSecretKey(ApiKey::where('key', 'stripe_secret_key')->first()->value) - ->withFacebookAppId(ApiKey::where('key', 'facebook_app_id')->first()->value) - ->withFacebookAppSecret(ApiKey::where('key', 'facebook_app_secret')->first()->value) - ->withChallongeApiKey(ApiKey::where('key', 'challonge_api_key')->first()->value) - ->withGoogleAnalyticsTrackingId(ApiKey::where('key', 'google_analytics_tracking_id')->first()->value) - ->withSteamApiKey(ApiKey::where('key', 'steam_api_key')->first()->value); + ->with('apiKeys', ApiKey::all()) + ->with('paypalUsername', ApiKey::where('key', 'paypal_username')->first()->value) + ->with('paypalPassword', ApiKey::where('key', 'paypal_password')->first()->value) + ->with('paypalSignature', ApiKey::where('key', 'paypal_signature')->first()->value) + ->with('stripePublicKey', ApiKey::where('key', 'stripe_public_key')->first()->value) + ->with('stripeSecretKey', ApiKey::where('key', 'stripe_secret_key')->first()->value) + ->with('facebookAppId', ApiKey::where('key', 'facebook_app_id')->first()->value) + ->with('facebookAppSecret', ApiKey::where('key', 'facebook_app_secret')->first()->value) + ->with('challongeApiKey', ApiKey::where('key', 'challonge_api_key')->first()->value) + ->with('googleAnalyticsTrackingId', ApiKey::where('key', 'google_analytics_tracking_id')->first()->value) + ->with('steamApiKey', ApiKey::where('key', 'steam_api_key')->first()->value); } /** diff --git a/src/app/Http/Controllers/Admin/ShopController.php b/src/app/Http/Controllers/Admin/ShopController.php index 5a752c7d..0255364a 100644 --- a/src/app/Http/Controllers/Admin/ShopController.php +++ b/src/app/Http/Controllers/Admin/ShopController.php @@ -29,9 +29,9 @@ class ShopController extends Controller public function index() { return view('admin.shop.index') - ->withIsShopEnabled(Settings::isShopEnabled()) - ->withCategories(ShopItemCategory::paginate(10, ['*'], 'sc')) - ->withItems(ShopItem::paginate(20, ['*'], 'it')); + ->with('isShopEnabled', Settings::isShopEnabled()) + ->with('categories', ShopItemCategory::paginate(10, ['*'], 'sc')) + ->with('items', ShopItem::paginate(20, ['*'], 'it')); } /** @@ -41,7 +41,7 @@ public function index() public function showCategory(ShopItemCategory $category) { return view('admin.shop.category') - ->withIsShopEnabled(Settings::isShopEnabled()) + ->with('isShopEnabled', Settings::isShopEnabled()) ->withCategory($category) ->withItems($category->items()->paginate()); } @@ -53,7 +53,7 @@ public function showCategory(ShopItemCategory $category) public function showItem(ShopItemCategory $category, ShopItem $item) { return view('admin.shop.item') - ->withIsShopEnabled(Settings::isShopEnabled()) + ->with('isShopEnabled', Settings::isShopEnabled()) ->withCategory($category) ->withItem($item); } diff --git a/src/app/Http/Controllers/Admin/UsersController.php b/src/app/Http/Controllers/Admin/UsersController.php index f4023ba9..221852da 100644 --- a/src/app/Http/Controllers/Admin/UsersController.php +++ b/src/app/Http/Controllers/Admin/UsersController.php @@ -29,7 +29,7 @@ public function index(Request $request) { if ($request->searchquery != "") { return view('admin.users.index') - ->withUser(Auth::user()) + ->with('user', Auth::user()) ->withUsers( User::where('username', 'LIKE', '%' . $request->searchquery . '%') ->orWhere('firstname', 'LIKE', '%' . $request->searchquery . '%') @@ -44,8 +44,8 @@ public function index(Request $request) } return view('admin.users.index') - ->withUser(Auth::user()) - ->withUsers(User::paginate(20)->appends(['searchquery' => $request->searchquery])); + ->with('user', Auth::user()) + ->with('users', User::paginate(20)->appends(['searchquery' => $request->searchquery])); } /** @@ -175,7 +175,7 @@ public function unauthorizeThirdparty(User $user, String $method) /** - * Remove User + * Remove User * @param User $user * @return View */ diff --git a/src/app/Http/Controllers/Auth/AuthController.php b/src/app/Http/Controllers/Auth/AuthController.php index caae0fa6..bf1d7441 100644 --- a/src/app/Http/Controllers/Auth/AuthController.php +++ b/src/app/Http/Controllers/Auth/AuthController.php @@ -80,7 +80,7 @@ protected function validator(array $data) public function prompt() { return view('auth.login') - ->withActiveLoginMethods(Settings::getLoginMethods()); + ->with('activeLoginMethods', Settings::getLoginMethods()); } /** diff --git a/src/app/Http/Controllers/Events/EventsController.php b/src/app/Http/Controllers/Events/EventsController.php index d36e331b..07efd29a 100644 --- a/src/app/Http/Controllers/Events/EventsController.php +++ b/src/app/Http/Controllers/Events/EventsController.php @@ -36,9 +36,9 @@ class EventsController extends Controller */ public function index() { - return view('events.index')->withEvents(Event::all()); + return view('events.index')->with('events', Event::all()); } - + /** * Show Event Page * @param Event $event @@ -109,7 +109,7 @@ public function generateICS(Event $event) ]; $address = implode(', ', array_filter($addressParts, function($value) { return !is_null($value) && $value !== ''; })); $address = str_replace([',', ';'], ['\,', '\;'], $address); - + $icsContent = "BEGIN:VCALENDAR\r\n"; $icsContent .= "VERSION:2.0\r\n"; $icsContent .= "PRODID:-//" . $orgName . "//" . $eventName . "//EN\r\n"; diff --git a/src/app/Http/Controllers/HomeController.php b/src/app/Http/Controllers/HomeController.php index 3caf0058..84a0b107 100644 --- a/src/app/Http/Controllers/HomeController.php +++ b/src/app/Http/Controllers/HomeController.php @@ -51,7 +51,7 @@ public function index() return $this->home(); } - // Loop trough the eventParticipants + // Loop trough the eventParticipants // The first one, whos event is currently running and that is active redirects to the event page foreach ($user->eventParticipants as $participant) { if ($participant->event->isRunningCurrently() && $participant->isActive()) { @@ -72,13 +72,13 @@ public function index() public function home() { return view("home") - ->withNextEvent(Event::nextUpcoming()->first()) - ->withTopAttendees(Helpers::getTopAttendees()) - ->withTopWinners(Helpers::getTopWinners()) - ->withGameServerList(Helpers::getPublicGameServers()) - ->withNewsArticles(NewsArticle::latestArticles()->get()) - ->withEvents(Event::all()) - ->withSliderImages(SliderImage::getImages('frontpage')) + ->with('nextEvent', Event::nextUpcoming()->first()) + ->with('topAttendees', Helpers::getTopAttendees()) + ->with('topWinners', Helpers::getTopWinners()) + ->with('gameServerList', Helpers::getPublicGameServers()) + ->with('newsArticles', NewsArticle::latestArticles()->get()) + ->with('events', Event::all()) + ->with('sliderImages', SliderImage::getImages('frontpage')) ; } @@ -187,7 +187,7 @@ public function event() ->withMemberedTeams($memberedteams) ->withOwnedMatches($ownedmatches) ->withCurrentUserOpenLivePendingDraftMatches($currentuseropenlivependingdraftmatches) - ->withisMatchMakingEnabled(Settings::isMatchMakingEnabled()) + ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) ->withEvent($event) ->withGameServerList($gameServerList) ->withTicketFlagSignedIn($ticketFlagSignedIn) diff --git a/src/app/Http/Controllers/MatchMakingController.php b/src/app/Http/Controllers/MatchMakingController.php index 3a538e72..fa376eef 100644 --- a/src/app/Http/Controllers/MatchMakingController.php +++ b/src/app/Http/Controllers/MatchMakingController.php @@ -60,7 +60,7 @@ public function index() ->withMemberedTeams($memberedteams) ->withOwnedMatches($ownedmatches) ->withCurrentUserOpenLivePendingDraftMatches($currentuseropenlivependingdraftmatches) - ->withisMatchMakingEnabled(Settings::isMatchMakingEnabled()); + ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()); } /** diff --git a/src/app/Http/Controllers/NewsController.php b/src/app/Http/Controllers/NewsController.php index a17ad142..652adc48 100644 --- a/src/app/Http/Controllers/NewsController.php +++ b/src/app/Http/Controllers/NewsController.php @@ -35,7 +35,7 @@ public function index() SEOMeta::addKeyword($seoKeywords); OpenGraph::addProperty('type', 'article'); return view('news.index') - ->withNewsArticles(NewsArticle::paginate(20)); + ->with('newsArticles', NewsArticle::paginate(20)); } /** diff --git a/src/app/Http/Controllers/PaymentsController.php b/src/app/Http/Controllers/PaymentsController.php index 0383b41b..36fa91eb 100644 --- a/src/app/Http/Controllers/PaymentsController.php +++ b/src/app/Http/Controllers/PaymentsController.php @@ -45,8 +45,8 @@ public function showCheckout() return Redirect::to('/'); } return view('payments.checkout') - ->withBasket(Helpers::formatBasket(Session::get(Settings::getOrgName() . '-basket'))) - ->withActivePaymentGateways(Settings::getPaymentGateways()) + ->with('basket', Helpers::formatBasket(Session::get(Settings::getOrgName() . '-basket'))) + ->with('activePaymentGateways', Settings::getPaymentGateways()) ; } @@ -78,7 +78,7 @@ public function showReview($paymentGateway) } return view('payments.review') ->withPaymentGateway($paymentGateway) - ->withBasket(Helpers::formatBasket($basket)) + ->with('basket', Helpers::formatBasket($basket)) ->withNextEventFlag($nextEventFlag) ; } @@ -103,7 +103,7 @@ public function showDetails($paymentGateway) } return view('payments.details') ->withPaymentGateway($paymentGateway) - ->withBasket(Helpers::formatBasket($basket, true)) + ->with('basket', Helpers::formatBasket($basket, true)) ->withDelivery($delivery) ->withDeliveryDetails($deliveryDetails) ; @@ -121,7 +121,7 @@ public function showDelivery($paymentGateway) } return view('payments.delivery') ->withPaymentGateway($paymentGateway) - ->withBasket(Helpers::formatBasket($basket, true)) + ->with('basket', Helpers::formatBasket($basket, true)) ; } @@ -367,7 +367,7 @@ public function post(Request $request) return Redirect::back(); } $responseStripe = $response->getData(); - + $purchaseParams = [ 'user_id' => Auth::id(), 'type' => 'Stripe', @@ -504,8 +504,8 @@ public function showSuccessful(Purchase $purchase) ->withBasket($basket) ->withPurchase($purchase) ; - } - + } + /** * Pending Payment Page * @param Purchase $purchase @@ -639,7 +639,7 @@ private function checkParams($paymentGateway, $basket) if($paymentGateway == 'free' && (Helpers::formatBasket($basket)->total > 0 || Helpers::formatBasket($basket)->total_credit > 0)) { Session::flash('alert-danger', __('payments.payment_method_not_allowed')); return false; - } + } if ($paymentGateway != 'credit' && $paymentGateway != 'free' && $paymentGateway != 'onsite' && !Helpers::formatBasket($basket)->allow_payment) { Session::flash('alert-danger', __('payments.payment_method_not_allowed')); return false; diff --git a/src/app/Http/Controllers/ShopController.php b/src/app/Http/Controllers/ShopController.php index c335a0dd..ffb931c1 100644 --- a/src/app/Http/Controllers/ShopController.php +++ b/src/app/Http/Controllers/ShopController.php @@ -33,7 +33,7 @@ public function index() $featuredItems = $featuredItems->merge(ShopItem::inRandomOrder()->where('featured', false)->paginate($count)); } return view('shop.index') - ->withAllCategories(ShopItemCategory::all()->sortBy('order')) + ->with('allCategories', ShopItemCategory::all()->sortBy('order')) ->withFeaturedItems($featuredItems); } @@ -49,7 +49,7 @@ public function showBasket() $basket = 'Empty'; } return view('shop.basket') - ->withAllCategories(ShopItemCategory::all()->sortBy('order')) + ->with('allCategories', ShopItemCategory::all()->sortBy('order')) ->withBasket($basket); } @@ -135,8 +135,8 @@ public function updateBasket(Request $request) public function showAllOrders() { return view('shop.orders.index') - ->withAllCategories(ShopItemCategory::all()->sortBy('order')) - ->withOrders(Auth::user()->getOrders()); + ->with('allCategories', ShopItemCategory::all()->sortBy('order')) + ->with('orders', Auth::user()->getOrders()); } /** @@ -146,7 +146,7 @@ public function showAllOrders() public function showOrder(ShopOrder $order) { return view('shop.orders.show') - ->withAllCategories(ShopItemCategory::all()->sortBy('order')) + ->with('allCategories', ShopItemCategory::all()->sortBy('order')) ->withOrder($order); } @@ -157,7 +157,7 @@ public function showOrder(ShopOrder $order) public function showCheckout() { return view('shop.checkout') - ->withAllCategories(ShopItemCategory::all()->sortBy('order')); + ->with('allCategories', ShopItemCategory::all()->sortBy('order')); } /** @@ -170,7 +170,7 @@ public function showCategory(ShopItemCategory $category) return view('shop.category') ->withCategory($category) ->withCategoryItems($category->items()->paginate(20)) - ->withAllCategories(ShopItemCategory::all()->sortBy('order')); + ->with('allCategories', ShopItemCategory::all()->sortBy('order')); } /** @@ -184,7 +184,7 @@ public function showItem(ShopItemCategory $category, ShopItem $item) return view('shop.item') ->withCategory($category) ->withItem($item) - ->withAllCategories(ShopItemCategory::all()->sortBy('order')); + ->with('allCategories', ShopItemCategory::all()->sortBy('order')); } } From ed6da3ce3a5ed5b2617738eba7e87fdf72118a4e Mon Sep 17 00:00:00 2001 From: TheR00st3r Date: Wed, 13 Nov 2024 22:45:49 +0100 Subject: [PATCH 2/3] Fix "with"s that use Variable --- .../Http/Controllers/AccountController.php | 30 +++++++-------- .../Controllers/Admin/AdminController.php | 34 ++++++++--------- .../Admin/AppearanceController.php | 2 +- .../Controllers/Admin/CreditController.php | 2 +- .../Admin/Events/EventsController.php | 6 +-- .../Admin/Events/ParticipantsController.php | 22 +++++------ .../Admin/Events/SeatingController.php | 38 +++++++++---------- .../Admin/Events/TicketsController.php | 14 +++---- .../Admin/Events/TimetablesController.php | 8 ++-- .../Admin/Events/TournamentsController.php | 34 ++++++++--------- .../Admin/Events/VenuesController.php | 6 +-- .../Controllers/Admin/GalleryController.php | 4 +- .../Admin/GameServersController.php | 4 +- .../Controllers/Admin/GamesController.php | 6 +-- .../Http/Controllers/Admin/HelpController.php | 4 +- .../Controllers/Admin/MailingController.php | 10 ++--- .../Admin/MatchMakingController.php | 14 +++---- .../Http/Controllers/Admin/NewsController.php | 4 +- .../Controllers/Admin/OrdersController.php | 2 +- .../Controllers/Admin/PollsController.php | 2 +- .../Controllers/Admin/PurchasesController.php | 2 +- .../Controllers/Admin/SettingsController.php | 2 +- .../Http/Controllers/Admin/ShopController.php | 8 ++-- .../Controllers/Admin/UsersController.php | 6 +-- .../Http/Controllers/Auth/SteamController.php | 4 +- .../Controllers/Events/EventsController.php | 2 +- .../Events/TournamentsController.php | 10 ++--- .../Http/Controllers/GalleryController.php | 6 +-- src/app/Http/Controllers/HelpController.php | 4 +- src/app/Http/Controllers/HomeController.php | 22 +++++------ .../Controllers/MatchMakingController.php | 20 +++++----- src/app/Http/Controllers/NewsController.php | 6 +-- .../Http/Controllers/PaymentsController.php | 24 ++++++------ src/app/Http/Controllers/PollsController.php | 6 +-- src/app/Http/Controllers/ShopController.php | 14 +++---- 35 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index bba27d05..5124b99a 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -29,10 +29,10 @@ public function index() $purchases = $user->purchases()->paginate(5, ['*'], 'pu'); $tickets = $user->eventParticipants()->paginate(5, ['*'], 'ti'); return view("accounts.index") - ->withUser($user) - ->withCreditLogs($creditLogs) - ->withPurchases($purchases) - ->withEventParticipants($tickets); + ->with('user', $user) + ->with('creditLogs', $creditLogs) + ->with('purchases', $purchases) + ->with('eventParticipants', $tickets); } /** @@ -44,7 +44,7 @@ public function showMail() $user = Auth::user(); return view("accounts.email") - ->withUser($user); + ->with('user', $user); } /** @@ -56,8 +56,8 @@ public function showRemoveSso($method) $user = Auth::user(); return view("accounts.removesso") - ->withUser($user) - ->withMethod($method); + ->with('user', $user) + ->with('method', $method); } @@ -139,11 +139,11 @@ public function showTokenWizzardStart($application = "", $callbackurl = "") foreach ($user->tokens as $currtoken) { if ($currtoken->name == $application) { - return view("accounts.tokenwizzard_start")->withStatus('exists')->withApplication($application)->withCallbackurl($callbackurl); + return view("accounts.tokenwizzard_start")->withStatus('exists')->with('application', $application)->with('callbackurl', $callbackurl); } } - return view("accounts.tokenwizzard_start")->withStatus("not_exists")->withApplication($application)->withCallbackurl($callbackurl); + return view("accounts.tokenwizzard_start")->withStatus("not_exists")->with('application', $application)->with('callbackurl', $callbackurl); } /** @@ -158,7 +158,7 @@ public function showTokenWizzardFinish(Request $request) foreach ($user->tokens as $currtoken) { if ($currtoken->name == $request->application) { if (!$currtoken->delete()) { - return view("accounts.tokenwizzard_finish")->withStatus('del_failed')->withApplication($request->application); + return view("accounts.tokenwizzard_finish")->withStatus('del_failed')->with('application', $request->application); } } } @@ -168,12 +168,12 @@ public function showTokenWizzardFinish(Request $request) $token = $user->createToken($request->application); if ($token->plainTextToken == null || $token->plainTextToken == "") { - return view("accounts.tokenwizzard_finish")->withStatus('creation_failed')->withApplication($request->application); + return view("accounts.tokenwizzard_finish")->withStatus('creation_failed')->with('application', $request->application); } $newcallbackurl = $request->callbackurl . "://" . $token->plainTextToken; - return view("accounts.tokenwizzard_finish")->withStatus('success')->withNewtoken($token->plainTextToken)->withApplication($request->application)->withCallbackurl($newcallbackurl); + return view("accounts.tokenwizzard_finish")->withStatus('success')->with('newtoken', $token->plainTextToken)->with('application', $request->application)->with('callbackurl', $newcallbackurl); } @@ -305,7 +305,7 @@ public function update(Request $request) $user->firstname = @$request->firstname; $user->surname = @$request->surname; - + if (isset($request->locale)) { $user->locale = @$request->locale; } @@ -362,7 +362,7 @@ public function update_local_avatar(Request $request) { $this->validate($request, [ 'avatar' => 'required|image|mimes:jpg,png,jpeg,gif,svg|max:2048', ]); - + if(!$path = Storage::putFile( 'public/images/avatars', $request->file('avatar') )) @@ -399,5 +399,5 @@ public function update_selected_avatar(Request $request) { return Redirect::back(); } - + } diff --git a/src/app/Http/Controllers/Admin/AdminController.php b/src/app/Http/Controllers/Admin/AdminController.php index 6d4f8848..24f62421 100644 --- a/src/app/Http/Controllers/Admin/AdminController.php +++ b/src/app/Http/Controllers/Admin/AdminController.php @@ -73,14 +73,14 @@ public function index() $ticketBreakdown[date_format($participant->created_at, 'm')][] = $participant; } return view('admin.index') - ->withUser($user) - ->withEvents($events) - ->withOrders($orders) - ->withParticipants($participants) - ->withVotes($votes) - ->withComments($comments) - ->withTickets($tickets) - ->withActivePolls($activePolls) + ->with('user', $user) + ->with('events', $events) + ->with('orders', $orders) + ->with('participants', $participants) + ->with('votes', $votes) + ->with('comments', $comments) + ->with('tickets', $tickets) + ->with('activePolls', $activePolls) ->with('shopEnabled', Settings::isShopEnabled()) ->with('galleryEnabled', Settings::isGalleryEnabled()) ->with('helpEnabled', Settings::isHelpEnabled()) @@ -89,15 +89,15 @@ public function index() ->with('activeLoginMethods', Settings::getLoginMethods()) ->with('supportedPaymentGateways', Settings::getSupportedPaymentGateways()) ->with('activePaymentGateways', Settings::getPaymentGateways()) - ->withFacebookCallback($facebookCallback) - ->withUserLastLoggedIn($userLastLoggedIn) - ->withUserCount($users->count()) - ->withUserLoginMethodCount($userLoginMethodCount) - ->withParticipantCount($participantCount) + ->with('facebookCallback', $facebookCallback) + ->with('userLastLoggedIn', $userLastLoggedIn) + ->with('userCount', $users->count()) + ->with('userLoginMethodCount', $userLoginMethodCount) + ->with('participantCount', $participantCount) ->with('nextEvent', Helpers::getNextEventName()) - ->withTournamentCount($tournamentCount) - ->withTournamentParticipantCount($tournamentParticipantCount) - ->withOrderBreakdown($orderBreakdown) - ->withTicketBreakdown($ticketBreakdown); + ->with('tournamentCount', $tournamentCount) + ->with('tournamentParticipantCount', $tournamentParticipantCount) + ->with('orderBreakdown', $orderBreakdown) + ->with('ticketBreakdown', $ticketBreakdown); } } diff --git a/src/app/Http/Controllers/Admin/AppearanceController.php b/src/app/Http/Controllers/Admin/AppearanceController.php index fc41c605..d5266216 100644 --- a/src/app/Http/Controllers/Admin/AppearanceController.php +++ b/src/app/Http/Controllers/Admin/AppearanceController.php @@ -44,7 +44,7 @@ public function index() return view('admin.settings.appearance') ->with('sliderImages', SliderImage::getImages('frontpage')) ->with('userOverrideCss', Appearance::getCssOverride()) - ->withCssVariables($sortedCssVariables); + ->with('cssVariables', $sortedCssVariables); } /** diff --git a/src/app/Http/Controllers/Admin/CreditController.php b/src/app/Http/Controllers/Admin/CreditController.php index 698ed5c1..7cbe45f9 100644 --- a/src/app/Http/Controllers/Admin/CreditController.php +++ b/src/app/Http/Controllers/Admin/CreditController.php @@ -33,7 +33,7 @@ public function index() return view('admin.credit.index') ->with('isCreditEnabled', Settings::isCreditEnabled()) ->with('creditLogs', CreditLog::paginate(10, ['*'], 'cl')) - ->withUsers($selectallusers); + ->with('users', $selectallusers); } /** diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index 969798da..c9efca2b 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -44,9 +44,9 @@ public function show(Event $event) { return view('admin.events.show') ->with('user', Auth::user()) - ->withEvent($event) - ->withAnnouncements($event->announcements()->paginate(5, ['*'], 'an')) - ->withParticipants($event->eventParticipants()->paginate(10, ['*'], 'ep')); + ->with('event', $event) + ->with('announcements', $event->announcements()->paginate(5, ['*'], 'an')) + ->with('participants', $event->eventParticipants()->paginate(10, ['*'], 'ep')); } /** diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index 71b5ab01..cbbbf04d 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -26,8 +26,8 @@ class ParticipantsController extends Controller public function index(Event $event) { return view('admin.events.participants.index') - ->withEvent($event) - ->withParticipants($event->allEventParticipants()->paginate(20)); + ->with('event', $event) + ->with('participants', $event->allEventParticipants()->paginate(20)); } /** @@ -39,8 +39,8 @@ public function index(Event $event) public function show(Event $event, EventParticipant $participant) { return view('admin.events.participants.show') - ->withEvent($event) - ->withParticipant($participant); + ->with('event', $event) + ->with('participant', $participant); } /** @@ -66,7 +66,7 @@ public function signIn(Event $event, EventParticipant $participant) if ($participant->event->slug != $event->slug) { Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); @@ -89,7 +89,7 @@ public function transfer(Event $event, EventParticipant $participant, Request $r if ($participant->event->slug != $event->slug) { Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); @@ -122,7 +122,7 @@ public function transfer(Event $event, EventParticipant $participant, Request $r * @return View */ public function signoutall(Event $event) - { + { foreach ($event->eventParticipants()->get() as $participant) { if (!$participant->setSignIn(false)) { @@ -141,11 +141,11 @@ public function signoutall(Event $event) * @return View */ public function signout(Event $event, EventParticipant $participant) - { + { if ($participant->event->slug != $event->slug) { Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } if ($participant->revoked) { Session::flash('alert-danger', 'Cannot sign out a revoked Participant!'); @@ -165,7 +165,7 @@ function revoke(Event $event, EventParticipant $participant) if ($participant->event->slug != $event->slug) { Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } if (!$participant->setRevoked()) { Session::flash('alert-danger', 'Cannot revoke Participant!'); @@ -180,7 +180,7 @@ function delete(Event $event, EventParticipant $participant) if ($participant->event->slug != $event->slug) { Session::flash('alert-danger', 'The selected participant does not belong to the selected event!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } if (!$participant->delete()) { Session::flash('alert-danger', 'Cannot delete participant'); diff --git a/src/app/Http/Controllers/Admin/Events/SeatingController.php b/src/app/Http/Controllers/Admin/Events/SeatingController.php index 74252281..7ea91f99 100644 --- a/src/app/Http/Controllers/Admin/Events/SeatingController.php +++ b/src/app/Http/Controllers/Admin/Events/SeatingController.php @@ -32,8 +32,8 @@ class SeatingController extends Controller public function index(Event $event) { return view('admin.events.seating.index') - ->withEvent($event) - ->withSeatingPlans($event->seatingPlans()->paginate(10)); + ->with('event', $event) + ->with('seatingPlans', $event->seatingPlans()->paginate(10)); } /** @@ -45,9 +45,9 @@ public function index(Event $event) public function show(Event $event, EventSeatingPlan $seatingPlan) { return view('admin.events.seating.show') - ->withEvent($event) - ->withSeatingPlan($seatingPlan) - ->withSeats($seatingPlan->seats()->where('status', 'ACTIVE')->paginate(15, ['*'], 'se')); + ->with('event', $event) + ->with('seatingPlan', $seatingPlan) + ->with('seats', $seatingPlan->seats()->where('status', 'ACTIVE')->paginate(15, ['*'], 'se')); } /** @@ -181,7 +181,7 @@ public function update(Event $event, EventSeatingPlan $seatingPlan, Request $req } if ($request->file('image') !== null) { - + if (isset($seatingPlan->image_path) && $seatingPlan->image_path != "") { Storage::delete($seatingPlan->image_path); @@ -215,7 +215,7 @@ public function update(Event $event, EventSeatingPlan $seatingPlan, Request $req public function destroy(Event $event, EventSeatingPlan $seatingPlan) { $seatPlanName = $seatingPlan->getName(); - + if (!$seatingPlan->delete()) { Session::flash('alert-danger', 'Could not delete Seating Plan ' . $seatPlanName . '!'); return Redirect::back(); @@ -353,7 +353,7 @@ public function storeSeat(Event $event, EventSeatingPlan $seatingPlan, Request $ return Redirect::back(); } - + //Make sure that any kind of status is given from view if (!isset($request->seat_status_select_modal) || trim($request->seat_status_select_modal) == '') { Session::flash('alert-danger', 'A status has to be selected!'); @@ -383,25 +383,25 @@ public function storeSeat(Event $event, EventSeatingPlan $seatingPlan, Request $ $clauses = [ 'event_participant_id' => $request->participant_select_modal ]; - $previousSeat = EventSeating::where($clauses)->first(); + $previousSeat = EventSeating::where($clauses)->first(); if ($previousSeat != null && $previousSeat->status == 'ACTIVE' && strtoupper($request->seat_status_select_modal) == 'ACTIVE') { $previousSeat->delete(); } //An occupied seat has to be cleared of itts seating first, before making any new changes $clauses = [ - 'column' => $request->seat_column, - 'row' => $request->seat_row, + 'column' => $request->seat_column, + 'row' => $request->seat_row, 'event_seating_plan_id' => $seatingPlan->id ]; $seat = EventSeating::where($clauses)->first(); - + if ($seat != null) { $seatName = $seat->getName(); Session::flash('alert-danger', 'Seat ' . $seatName . ' is still occupied. Please try again or delete the seating first!'); return Redirect::back(); } - + //If status is set to active, the seat has to be paired with an event participant if ((!isset($request->participant_select_modal) && trim($request->participant_select_modal) == '') && strtoupper($request->seat_status_select_modal) == 'ACTIVE' @@ -427,7 +427,7 @@ public function storeSeat(Event $event, EventSeatingPlan $seatingPlan, Request $ $seatName = $newSeat->getName(); $seatPlanName = $seatingPlan->getName(); - + if (!$newSeat->save()) { Session::flash('alert-danger', 'Could not store or update seat ' . $seatName . ' of seating plan ' . $seatPlanName . '!'); return Redirect::back(); @@ -446,20 +446,20 @@ public function storeSeat(Event $event, EventSeatingPlan $seatingPlan, Request $ */ public function destroySeat(Event $event, EventSeatingPlan $seatingPlan, Request $request) { - + $rules = [ 'seat_column_delete' => 'required', 'seat_row_delete' => 'required', ]; $messages = [ 'seat_column_delete|required' => 'A seat column is required', - 'seat_row_delete|required' => 'A seat row is required', + 'seat_row_delete|required' => 'A seat row is required', ]; - $this->validate($request, $rules, $messages); - + $this->validate($request, $rules, $messages); + $clauses = [ - 'column' => $request->seat_column_delete, + 'column' => $request->seat_column_delete, 'row' => $request->seat_row_delete ]; if (!$seat = $seatingPlan->seats()->where($clauses)->first()) { diff --git a/src/app/Http/Controllers/Admin/Events/TicketsController.php b/src/app/Http/Controllers/Admin/Events/TicketsController.php index 9d4570b4..7dd95b90 100644 --- a/src/app/Http/Controllers/Admin/Events/TicketsController.php +++ b/src/app/Http/Controllers/Admin/Events/TicketsController.php @@ -37,16 +37,16 @@ public function index(Event $event) $totalFreeTickets = $systemtickets->sum(function($user) use ($event) { return $user->getFreeTickets($event->id)->count(); }); - + $totalStaffTickets = $systemtickets->sum(function($user) use ($event) { return $user->getStaffTickets($event->id)->count(); }); return view('admin.events.tickets.index') - ->withEvent($event) - ->withTotalFreeTickets($totalFreeTickets) - ->withTotalStaffTickets($totalStaffTickets) - ->withUsers($users); + ->with('event', $event) + ->with('totalFreeTickets', $totalFreeTickets) + ->with('totalStaffTickets', $totalStaffTickets) + ->with('users', $users); } /** @@ -58,8 +58,8 @@ public function index(Event $event) public function show(Event $event, EventTicket $ticket) { return view('admin.events.tickets.show') - ->withEvent($event) - ->withTicket($ticket); + ->with('event', $event) + ->with('ticket', $ticket); } /** diff --git a/src/app/Http/Controllers/Admin/Events/TimetablesController.php b/src/app/Http/Controllers/Admin/Events/TimetablesController.php index 45766257..ce496e51 100644 --- a/src/app/Http/Controllers/Admin/Events/TimetablesController.php +++ b/src/app/Http/Controllers/Admin/Events/TimetablesController.php @@ -30,7 +30,7 @@ class TimetablesController extends Controller public function index(Event $event) { return view('admin.events.timetables.index') - ->withEvent($event); + ->with('event', $event); } /** @@ -43,8 +43,8 @@ public function show(Event $event, EventTimetable $timetable) { $timetable->data = $timetable->data->sortBy('start_time'); return view('admin.events.timetables.show') - ->withEvent($event) - ->withTimetable($timetable); + ->with('event', $event) + ->with('timetable', $timetable); } /** @@ -129,7 +129,7 @@ public function destroy(Event $event, EventTimetable $timetable, Request $reques Session::flash('alert-danger', 'Cannot delete Timetable!'); return Redirect::back(); } - + Session::flash('alert-success', 'Successfully deleted Timetable!'); return Redirect::back(); } diff --git a/src/app/Http/Controllers/Admin/Events/TournamentsController.php b/src/app/Http/Controllers/Admin/Events/TournamentsController.php index 8a49ec29..dc77f7e3 100644 --- a/src/app/Http/Controllers/Admin/Events/TournamentsController.php +++ b/src/app/Http/Controllers/Admin/Events/TournamentsController.php @@ -40,8 +40,8 @@ class TournamentsController extends Controller public function index(Event $event) { return view('admin.events.tournaments.index') - ->withEvent($event) - ->withTournaments($event->tournaments()->paginate(10)) + ->with('event', $event) + ->with('tournaments', $event->tournaments()->paginate(10)) ; } @@ -54,8 +54,8 @@ public function index(Event $event) public function show(Event $event, EventTournament $tournament) { return view('admin.events.tournaments.show') - ->withEvent($event) - ->withTournament($tournament); + ->with('event', $event) + ->with('tournament', $tournament); } /** @@ -169,7 +169,7 @@ public function update(Event $event, EventTournament $tournament, Request $reque $tournament->rules = $request->rules; $tournament->bestof = $request->bestof; - + $disallowed_array = ['OPEN', 'CLOSED', 'LIVE', 'COMPLETED']; if (!in_array($tournament->status, $disallowed_array)) { $game_id = null; @@ -300,7 +300,7 @@ public function start(Event $event, EventTournament $tournament) if (isset($tournament->game) && $tournament->match_autostart) { - + $nextmatches = $tournament->getNextMatches(); @@ -309,7 +309,7 @@ public function start(Event $event, EventTournament $tournament) GameServerAsign::dispatch(null,$tournament,$nextmatch->id)->onQueue('gameserver'); } - + } @@ -437,7 +437,7 @@ public function addPug(Event $event, EventTournament $tournament, EventParticipa Session::flash('alert-danger', __('events.tournament_cannot_join_thirdparty')); return Redirect::back(); } - + } } @@ -497,7 +497,7 @@ public function addSingle(Event $event, EventTournament $tournament, EventPartic } } - + // TODO - Refactor $tournamentParticipant = new EventTournamentParticipant(); $tournamentParticipant->event_participant_id = $participant->id; @@ -522,7 +522,7 @@ public function addSingle(Event $event, EventTournament $tournament, EventPartic */ public function addTeam(Event $event, EventTournament $tournament, Request $request) { - + $tournamentTeam = new EventTournamentTeam(); $tournamentTeam->event_tournament_id = $tournament->id; $tournamentTeam->name = $request->team_name; @@ -600,7 +600,7 @@ public function updateMatch(Event $event, EventTournament $tournament, Request $ if (isset($tournament->game) && $tournament->match_autostart) { - + $nextmatches = $tournament->getNextMatches(); @@ -609,7 +609,7 @@ public function updateMatch(Event $event, EventTournament $tournament, Request $ GameServerAsign::dispatch(null,$tournament,$nextmatch->id)->onQueue('gameserver'); } - + } @@ -622,12 +622,12 @@ public function updateMatch(Event $event, EventTournament $tournament, Request $ Session::flash('alert-danger', 'Cannot delete EventTournamentMatchServer entry, you have to remove the assignment manually'); return Redirect::back(); } - - + + } - - - + + + Session::flash('alert-success', 'Successfully updated match scores!'); return Redirect::back(); diff --git a/src/app/Http/Controllers/Admin/Events/VenuesController.php b/src/app/Http/Controllers/Admin/Events/VenuesController.php index 838e5ba0..5d0c2056 100644 --- a/src/app/Http/Controllers/Admin/Events/VenuesController.php +++ b/src/app/Http/Controllers/Admin/Events/VenuesController.php @@ -40,7 +40,7 @@ public function index() public function show(EventVenue $venue) { return view('admin.events.venues.show') - ->withVenue($venue); + ->with('venue', $venue); } /** @@ -83,7 +83,7 @@ public function store(Request $request) } if (!$validCountry) { Session::flash('alert-danger', 'That country appears to be invalid. Please use a valid one.'); - return Redirect::back()->withInput($request->input())->withError('That country appears to be invalid. Please use a valid one.'); + return Redirect::back()->with('input', $request->input())->withError('That country appears to be invalid. Please use a valid one.'); } if (isset($request->address_postcode) && $request->address_postcode != null && trim($request->address_postcode) != '') { @@ -193,7 +193,7 @@ public function update(EventVenue $venue, Request $request) } if (!$validCountry) { Session::flash('alert-danger', 'That country appears to be invalid. Please use a valid one.'); - return Redirect::back()->withInput($request->input())->withError('That country appears to be invalid. Please use a valid one.'); + return Redirect::back()->with('input', $request->input())->withError('That country appears to be invalid. Please use a valid one.'); } if (isset($request->address_postcode) && $request->address_postcode != null && trim($request->address_postcode) != '') { diff --git a/src/app/Http/Controllers/Admin/GalleryController.php b/src/app/Http/Controllers/Admin/GalleryController.php index fc502649..3c29be4e 100644 --- a/src/app/Http/Controllers/Admin/GalleryController.php +++ b/src/app/Http/Controllers/Admin/GalleryController.php @@ -44,8 +44,8 @@ public function index() public function show(GalleryAlbum $album) { return view('admin.gallery.show') - ->withAlbum($album) - ->withImages($album->images()->paginate(10)) + ->with('album', $album) + ->with('images', $album->images()->paginate(10)) ->with('isGalleryEnabled', Settings::isGalleryEnabled()) ; } diff --git a/src/app/Http/Controllers/Admin/GameServersController.php b/src/app/Http/Controllers/Admin/GameServersController.php index 79bfe1aa..1a712074 100644 --- a/src/app/Http/Controllers/Admin/GameServersController.php +++ b/src/app/Http/Controllers/Admin/GameServersController.php @@ -29,7 +29,7 @@ class GameServersController extends Controller public function show(Game $game, GameServer $gameServer) { return view('admin.games.gameserver.show') - ->withGameServer($gameServer); + ->with('gameServer', $gameServer); } /** @@ -142,7 +142,7 @@ public function update(Game $game, GameServer $gameServer, Request $request) * @return Redirect */ public function updatetoken(Game $game, GameServer $gameServer, Request $request) - { + { $gameServer->tokens()->delete(); $token = $gameServer->createToken("gs_" . Str::random()); if (!isset($token->plainTextToken) || $token->plainTextToken == "") diff --git a/src/app/Http/Controllers/Admin/GamesController.php b/src/app/Http/Controllers/Admin/GamesController.php index 0ce66e9e..50fff88a 100644 --- a/src/app/Http/Controllers/Admin/GamesController.php +++ b/src/app/Http/Controllers/Admin/GamesController.php @@ -51,9 +51,9 @@ public function show(Game $game) } return view('admin.games.show') - ->withAllCommands($allcommands) - ->withGame($game) - ->withMatchCountError($matchcounterror); + ->with('allCommands', $allcommands) + ->with('game', $game) + ->with('matchCountError', $matchcounterror); } /** diff --git a/src/app/Http/Controllers/Admin/HelpController.php b/src/app/Http/Controllers/Admin/HelpController.php index 7e872c63..92dbe566 100644 --- a/src/app/Http/Controllers/Admin/HelpController.php +++ b/src/app/Http/Controllers/Admin/HelpController.php @@ -45,8 +45,8 @@ public function index() public function show(HelpCategory $helpCategory) { return view('admin.help.show') - ->withHelpCategory($helpCategory) - ->withEntrys($helpCategory->entrys()->paginate(10)) + ->with('helpCategory', $helpCategory) + ->with('entrys', $helpCategory->entrys()->paginate(10)) ->with('isHelpEnabled', Settings::isHelpEnabled()) ; } diff --git a/src/app/Http/Controllers/Admin/MailingController.php b/src/app/Http/Controllers/Admin/MailingController.php index 9ec05371..502a4ae1 100644 --- a/src/app/Http/Controllers/Admin/MailingController.php +++ b/src/app/Http/Controllers/Admin/MailingController.php @@ -46,9 +46,9 @@ public function index() } return view('admin.mailing.index')->with('mailTemplates', MailTemplate::all()) ->with('mailVariables', EventulaMailingMail::getVariables()) - ->withUsersWithMail($selectallusers) - ->withNextEvent($nextevent) - ->withUser($user); + ->with('usersWithMail', $selectallusers) + ->with('nextEvent', $nextevent) + ->with('user', $user); } /** @@ -59,8 +59,8 @@ public function index() public function show(MailTemplate $mailTemplate) { return view('admin.mailing.show') - ->withMailTemplate($mailTemplate) - ->withMailVariables($mailTemplate->mailable::getVariables()); + ->with('mailTemplate', $mailTemplate) + ->with('mailVariables', $mailTemplate->mailable::getVariables()); } /** diff --git a/src/app/Http/Controllers/Admin/MatchMakingController.php b/src/app/Http/Controllers/Admin/MatchMakingController.php index 4eb246f8..1b9cc004 100644 --- a/src/app/Http/Controllers/Admin/MatchMakingController.php +++ b/src/app/Http/Controllers/Admin/MatchMakingController.php @@ -48,11 +48,11 @@ public function index() $selectallusers[$user->id] = $user->username; } return view('admin.matchmaking.index') - ->withMatches($matches) - ->withPendingMatches($pendingmatches) - ->withLiveMatches($livematches) + ->with('matches', $matches) + ->with('pendingMatches', $pendingmatches) + ->with('liveMatches', $livematches) ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) - ->withUsers($selectallusers); + ->with('users', $selectallusers); } @@ -100,9 +100,9 @@ public function show(MatchMaking $match) return view('admin.matchmaking.show') - ->withMatch($match) - ->withAvailableUsers($availableusers) - ->withUsers($selectallusers); + ->with('match', $match) + ->with('availableUsers', $availableusers) + ->with('users', $selectallusers); } diff --git a/src/app/Http/Controllers/Admin/NewsController.php b/src/app/Http/Controllers/Admin/NewsController.php index 5e362295..830509ef 100644 --- a/src/app/Http/Controllers/Admin/NewsController.php +++ b/src/app/Http/Controllers/Admin/NewsController.php @@ -51,8 +51,8 @@ public function index() public function show(NewsArticle $newsArticle) { return view('admin.news.show') - ->withNewsArticle($newsArticle) - ->withComments($newsArticle->comments()->paginate(10, ['*'], 'cm')) + ->with('newsArticle', $newsArticle) + ->with('comments', $newsArticle->comments()->paginate(10, ['*'], 'cm')) ; } diff --git a/src/app/Http/Controllers/Admin/OrdersController.php b/src/app/Http/Controllers/Admin/OrdersController.php index 6ab731fc..47f8af1f 100644 --- a/src/app/Http/Controllers/Admin/OrdersController.php +++ b/src/app/Http/Controllers/Admin/OrdersController.php @@ -36,7 +36,7 @@ public function index() public function show(ShopOrder $order) { return view('admin.orders.show') - ->withOrder($order); + ->with('order', $order); } /** diff --git a/src/app/Http/Controllers/Admin/PollsController.php b/src/app/Http/Controllers/Admin/PollsController.php index 4dbf3df7..bd4bbf51 100644 --- a/src/app/Http/Controllers/Admin/PollsController.php +++ b/src/app/Http/Controllers/Admin/PollsController.php @@ -40,7 +40,7 @@ public function show(Poll $poll) { $poll->sortOptions(); return view('admin.polls.show') - ->withPoll($poll); + ->with('poll', $poll); } public function update(Poll $poll, Request $request) diff --git a/src/app/Http/Controllers/Admin/PurchasesController.php b/src/app/Http/Controllers/Admin/PurchasesController.php index a4f5b769..df1039dc 100644 --- a/src/app/Http/Controllers/Admin/PurchasesController.php +++ b/src/app/Http/Controllers/Admin/PurchasesController.php @@ -74,7 +74,7 @@ public function showRevoked() public function show(Purchase $purchase) { return view('admin.purchases.show') - ->withPurchase($purchase); + ->with('purchase', $purchase); } /** diff --git a/src/app/Http/Controllers/Admin/SettingsController.php b/src/app/Http/Controllers/Admin/SettingsController.php index f4de7a8a..ede93847 100644 --- a/src/app/Http/Controllers/Admin/SettingsController.php +++ b/src/app/Http/Controllers/Admin/SettingsController.php @@ -50,7 +50,7 @@ public function index() ->with('isHelpEnabled', Settings::isHelpEnabled()) ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) ->with('isCreditEnabled', Settings::isCreditEnabled()) - ->withFacebookCallback($facebookCallback) + ->with('facebookCallback', $facebookCallback) ->with('facebookIsLinked', Facebook::isLinked()) ->with('supportedLoginMethods', Settings::getSupportedLoginMethods()) ->with('activeLoginMethods', Settings::getLoginMethods()); diff --git a/src/app/Http/Controllers/Admin/ShopController.php b/src/app/Http/Controllers/Admin/ShopController.php index 0255364a..63bf1256 100644 --- a/src/app/Http/Controllers/Admin/ShopController.php +++ b/src/app/Http/Controllers/Admin/ShopController.php @@ -42,8 +42,8 @@ public function showCategory(ShopItemCategory $category) { return view('admin.shop.category') ->with('isShopEnabled', Settings::isShopEnabled()) - ->withCategory($category) - ->withItems($category->items()->paginate()); + ->with('category', $category) + ->with('items', $category->items()->paginate()); } /** @@ -54,8 +54,8 @@ public function showItem(ShopItemCategory $category, ShopItem $item) { return view('admin.shop.item') ->with('isShopEnabled', Settings::isShopEnabled()) - ->withCategory($category) - ->withItem($item); + ->with('category', $category) + ->with('item', $item); } /** diff --git a/src/app/Http/Controllers/Admin/UsersController.php b/src/app/Http/Controllers/Admin/UsersController.php index 221852da..9167783c 100644 --- a/src/app/Http/Controllers/Admin/UsersController.php +++ b/src/app/Http/Controllers/Admin/UsersController.php @@ -59,9 +59,9 @@ public function show(User $user) $creditLogs = $user->creditLogs()->paginate(5, ['*'], 'cl'); } return view('admin.users.show') - ->withUserShow($user) - ->withCreditLogs($creditLogs) - ->withPurchases($user->purchases()->paginate(10, ['*'], 'pu')); + ->with('userShow', $user) + ->with('creditLogs', $creditLogs) + ->with('purchases', $user->purchases()->paginate(10, ['*'], 'pu')); } /** diff --git a/src/app/Http/Controllers/Auth/SteamController.php b/src/app/Http/Controllers/Auth/SteamController.php index a4c4e042..1d246f85 100644 --- a/src/app/Http/Controllers/Auth/SteamController.php +++ b/src/app/Http/Controllers/Auth/SteamController.php @@ -116,14 +116,14 @@ private function addtoexistingaccount($info, User $user) if ($validator->fails()) { return redirect('/account/') - ->withErrors($validator) + ->with('errors', $validator) ->withInput(); } $user->steamname = $info->personaname; $user->steam_avatar = $info->avatarfull; $user->selected_avatar = 'steam'; - + $user->steamid = $info->steamID64; if ($user->save()) { Session::flash('alert-success', "Successfully added steam account!"); diff --git a/src/app/Http/Controllers/Events/EventsController.php b/src/app/Http/Controllers/Events/EventsController.php index 07efd29a..ea9f7b87 100644 --- a/src/app/Http/Controllers/Events/EventsController.php +++ b/src/app/Http/Controllers/Events/EventsController.php @@ -83,7 +83,7 @@ public function show(Event $event) OpenGraph::addProperty('type', 'article'); return view('events.show') - ->withEvent($event); + ->with('event', $event); } /** diff --git a/src/app/Http/Controllers/Events/TournamentsController.php b/src/app/Http/Controllers/Events/TournamentsController.php index 30f63a81..4a8d28dd 100644 --- a/src/app/Http/Controllers/Events/TournamentsController.php +++ b/src/app/Http/Controllers/Events/TournamentsController.php @@ -53,9 +53,9 @@ public function show(Event $event, EventTournament $tournament, Request $request } return view('events.tournaments.show') - ->withTournament($tournament) - ->withEvent($event) - ->withUser($user); + ->with('tournament', $tournament) + ->with('event', $event) + ->with('user', $user); } @@ -72,7 +72,7 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques Session::flash('alert-danger', __('events.tournament_signups_not_permitted')); return Redirect::back(); } - + if (!$tournament->event->eventParticipants()->where('id', $request->event_participant_id)->first()) { @@ -112,7 +112,7 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques Session::flash('alert-danger', __('events.tournament_staff_not_permitted')); return Redirect::back(); } - + // Check if a freebie is trying to register if ($eventParticipant->free && !$event->tournaments_freebie) { Session::flash('alert-danger', __('events.tournament_freebie_not_permitted')); diff --git a/src/app/Http/Controllers/GalleryController.php b/src/app/Http/Controllers/GalleryController.php index 82c62828..7479d902 100644 --- a/src/app/Http/Controllers/GalleryController.php +++ b/src/app/Http/Controllers/GalleryController.php @@ -25,8 +25,8 @@ public function index() $event = Event::where('start', '>=', date("Y-m-d 00:00:00"))->first(); $albums = GalleryAlbum::all(); return view('gallery.index') - ->withAlbums($albums) - ->withEvent($event); + ->with('albums', $albums) + ->with('event', $event); } /** @@ -37,6 +37,6 @@ public function index() public function show(GalleryAlbum $album) { return view('gallery.show') - ->withAlbum($album); + ->with('album', $album); } } diff --git a/src/app/Http/Controllers/HelpController.php b/src/app/Http/Controllers/HelpController.php index 7dc27a43..1a9f2276 100644 --- a/src/app/Http/Controllers/HelpController.php +++ b/src/app/Http/Controllers/HelpController.php @@ -25,7 +25,7 @@ public function index() $event = Event::where('start', '>=', date("Y-m-d 00:00:00"))->first(); $helpCategorys = HelpCategory::all(); return view('help.index') - ->withHelpCategorys($helpCategorys) - ->withEvent($event); + ->with('helpCategorys', $helpCategorys) + ->with('event', $event); } } diff --git a/src/app/Http/Controllers/HomeController.php b/src/app/Http/Controllers/HomeController.php index 84a0b107..9d4a0e25 100644 --- a/src/app/Http/Controllers/HomeController.php +++ b/src/app/Http/Controllers/HomeController.php @@ -182,17 +182,17 @@ public function event() } return view("events.home") - ->withOpenPublicMatches($openpublicmatches) - ->withLiveClosedPublicMatches($liveclosedpublicmatches) - ->withMemberedTeams($memberedteams) - ->withOwnedMatches($ownedmatches) - ->withCurrentUserOpenLivePendingDraftMatches($currentuseropenlivependingdraftmatches) + ->with('openPublicMatches', $openpublicmatches) + ->with('liveClosedPublicMatches', $liveclosedpublicmatches) + ->with('memberedTeams', $memberedteams) + ->with('ownedMatches', $ownedmatches) + ->with('currentUserOpenLivePendingDraftMatches', $currentuseropenlivependingdraftmatches) ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()) - ->withEvent($event) - ->withGameServerList($gameServerList) - ->withTicketFlagSignedIn($ticketFlagSignedIn) - ->withSignedIn($signedIn) - ->withUser($user); + ->with('event', $event) + ->with('gameServerList', $gameServerList) + ->with('ticketFlagSignedIn', $ticketFlagSignedIn) + ->with('signedIn', $signedIn) + ->with('user', $user); } /** @@ -202,6 +202,6 @@ public function event() */ public function bigScreen(Event $event) { - return view("events.big")->withEvent($event); + return view("events.big")->with('event', $event); } } diff --git a/src/app/Http/Controllers/MatchMakingController.php b/src/app/Http/Controllers/MatchMakingController.php index fa376eef..51adf21d 100644 --- a/src/app/Http/Controllers/MatchMakingController.php +++ b/src/app/Http/Controllers/MatchMakingController.php @@ -55,11 +55,11 @@ public function index() } return view('matchmaking.index') - ->withOpenPublicMatches($openpublicmatches) - ->withLiveClosedPublicMatches($liveclosedpublicmatches) - ->withMemberedTeams($memberedteams) - ->withOwnedMatches($ownedmatches) - ->withCurrentUserOpenLivePendingDraftMatches($currentuseropenlivependingdraftmatches) + ->with('openPublicMatches', $openpublicmatches) + ->with('liveClosedPublicMatches', $liveclosedpublicmatches) + ->with('memberedTeams', $memberedteams) + ->with('ownedMatches', $ownedmatches) + ->with('currentUserOpenLivePendingDraftMatches', $currentuseropenlivependingdraftmatches) ->with('isMatchMakingEnabled', Settings::isMatchMakingEnabled()); } @@ -125,11 +125,11 @@ public function show(MatchMaking $match, Request $request) return view('matchmaking.show') - ->withMatch($match) - ->withAvailableUsers($availableusers) - ->withUsers($selectallusers) - ->withTeamJoin($teamjoin) - ->withInvite($invite); + ->with('match', $match) + ->with('availableUsers', $availableusers) + ->with('users', $selectallusers) + ->with('teamJoin', $teamjoin) + ->with('invite', $invite); } /** diff --git a/src/app/Http/Controllers/NewsController.php b/src/app/Http/Controllers/NewsController.php index 652adc48..c4f28df0 100644 --- a/src/app/Http/Controllers/NewsController.php +++ b/src/app/Http/Controllers/NewsController.php @@ -55,7 +55,7 @@ public function show(NewsArticle $newsArticle) OpenGraph::setDescription(Helpers::getSeoCustomDescription($newsArticle->title)); OpenGraph::addProperty('type', 'article'); return view('news.show') - ->withNewsArticle($newsArticle); + ->with('newsArticle', $newsArticle); } /** @@ -75,8 +75,8 @@ public function showTag(NewsTag $newsTag) $newsArticles[] = $newsTag->newsArticle; } return view('news.tag') - ->withTag($newsTag->tag) - ->withNewsArticles($newsArticles); + ->with('tag', $newsTag->tag) + ->with('newsArticles', $newsArticles); } /** diff --git a/src/app/Http/Controllers/PaymentsController.php b/src/app/Http/Controllers/PaymentsController.php index 36fa91eb..0488ae82 100644 --- a/src/app/Http/Controllers/PaymentsController.php +++ b/src/app/Http/Controllers/PaymentsController.php @@ -77,9 +77,9 @@ public function showReview($paymentGateway) } } return view('payments.review') - ->withPaymentGateway($paymentGateway) + ->with('paymentGateway', $paymentGateway) ->with('basket', Helpers::formatBasket($basket)) - ->withNextEventFlag($nextEventFlag) + ->with('nextEventFlag', $nextEventFlag) ; } @@ -102,10 +102,10 @@ public function showDetails($paymentGateway) } } return view('payments.details') - ->withPaymentGateway($paymentGateway) + ->with('paymentGateway', $paymentGateway) ->with('basket', Helpers::formatBasket($basket, true)) - ->withDelivery($delivery) - ->withDeliveryDetails($deliveryDetails) + ->with('delivery', $delivery) + ->with('deliveryDetails', $deliveryDetails) ; } @@ -120,7 +120,7 @@ public function showDelivery($paymentGateway) return Redirect::back(); } return view('payments.delivery') - ->withPaymentGateway($paymentGateway) + ->with('paymentGateway', $paymentGateway) ->with('basket', Helpers::formatBasket($basket, true)) ; } @@ -500,9 +500,9 @@ public function showSuccessful(Purchase $purchase) Session::forget('params'); Session::forget(Settings::getOrgName() . '-basket'); return view('payments.successful') - ->withType($type) - ->withBasket($basket) - ->withPurchase($purchase) + ->with('type', $type) + ->with('basket', $basket) + ->with('purchase', $purchase) ; } @@ -525,9 +525,9 @@ public function showPending(Purchase $purchase) Session::forget('params'); Session::forget(Settings::getOrgName() . '-basket'); return view('payments.pending') - ->withType($type) - ->withBasket($basket) - ->withPurchase($purchase) + ->with('type', $type) + ->with('basket', $basket) + ->with('purchase', $purchase) ; } diff --git a/src/app/Http/Controllers/PollsController.php b/src/app/Http/Controllers/PollsController.php index 73490ba6..787f1e58 100644 --- a/src/app/Http/Controllers/PollsController.php +++ b/src/app/Http/Controllers/PollsController.php @@ -29,8 +29,8 @@ public function index() ->whereNull('event_id') ->paginate(10, ['*'], 'page'); return view("polls.index") - ->withActivePolls($activePolls) - ->withEndedPolls($endedPolls); + ->with('activePolls', $activePolls) + ->with('endedPolls', $endedPolls); } /** @@ -41,7 +41,7 @@ public function show(Poll $poll) { $poll->sortOptions(); return view("polls.show") - ->withPoll($poll); + ->with('poll', $poll); } /** diff --git a/src/app/Http/Controllers/ShopController.php b/src/app/Http/Controllers/ShopController.php index ffb931c1..ead5063f 100644 --- a/src/app/Http/Controllers/ShopController.php +++ b/src/app/Http/Controllers/ShopController.php @@ -34,7 +34,7 @@ public function index() } return view('shop.index') ->with('allCategories', ShopItemCategory::all()->sortBy('order')) - ->withFeaturedItems($featuredItems); + ->with('featuredItems', $featuredItems); } /** @@ -50,7 +50,7 @@ public function showBasket() } return view('shop.basket') ->with('allCategories', ShopItemCategory::all()->sortBy('order')) - ->withBasket($basket); + ->with('basket', $basket); } /** @@ -147,7 +147,7 @@ public function showOrder(ShopOrder $order) { return view('shop.orders.show') ->with('allCategories', ShopItemCategory::all()->sortBy('order')) - ->withOrder($order); + ->with('order', $order); } /** @@ -168,8 +168,8 @@ public function showCheckout() public function showCategory(ShopItemCategory $category) { return view('shop.category') - ->withCategory($category) - ->withCategoryItems($category->items()->paginate(20)) + ->with('category', $category) + ->with('categoryItems', $category->items()->paginate(20)) ->with('allCategories', ShopItemCategory::all()->sortBy('order')); } @@ -182,8 +182,8 @@ public function showCategory(ShopItemCategory $category) public function showItem(ShopItemCategory $category, ShopItem $item) { return view('shop.item') - ->withCategory($category) - ->withItem($item) + ->with('category', $category) + ->with('item', $item) ->with('allCategories', ShopItemCategory::all()->sortBy('order')); } From 89608765827f43293e80f196c7676ee1e31c7f49 Mon Sep 17 00:00:00 2001 From: TheR00st3r Date: Wed, 13 Nov 2024 22:47:01 +0100 Subject: [PATCH 3/3] Fix with constant strings --- src/app/Http/Controllers/AccountController.php | 16 ++++++++-------- .../Admin/Events/VenuesController.php | 4 ++-- src/app/Http/Controllers/Auth/AuthController.php | 6 +++--- .../Http/Controllers/Auth/LoginController.php | 2 +- .../Http/Controllers/Auth/SteamController.php | 6 +++--- src/app/Http/Middleware/Banned.php | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index 5124b99a..560ff77a 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -133,13 +133,13 @@ public function showTokenWizzardStart($application = "", $callbackurl = "") { $user = Auth::user(); if ($application == null || $application == "") { - return view("accounts.tokenwizzard_start")->withStatus('no_application'); + return view("accounts.tokenwizzard_start")->with('status', 'no_application'); } foreach ($user->tokens as $currtoken) { if ($currtoken->name == $application) { - return view("accounts.tokenwizzard_start")->withStatus('exists')->with('application', $application)->with('callbackurl', $callbackurl); + return view("accounts.tokenwizzard_start")->with('status', 'exists')->with('application', $application)->with('callbackurl', $callbackurl); } } @@ -158,7 +158,7 @@ public function showTokenWizzardFinish(Request $request) foreach ($user->tokens as $currtoken) { if ($currtoken->name == $request->application) { if (!$currtoken->delete()) { - return view("accounts.tokenwizzard_finish")->withStatus('del_failed')->with('application', $request->application); + return view("accounts.tokenwizzard_finish")->with('status', 'del_failed')->with('application', $request->application); } } } @@ -168,12 +168,12 @@ public function showTokenWizzardFinish(Request $request) $token = $user->createToken($request->application); if ($token->plainTextToken == null || $token->plainTextToken == "") { - return view("accounts.tokenwizzard_finish")->withStatus('creation_failed')->with('application', $request->application); + return view("accounts.tokenwizzard_finish")->with('status', 'creation_failed')->with('application', $request->application); } $newcallbackurl = $request->callbackurl . "://" . $token->plainTextToken; - return view("accounts.tokenwizzard_finish")->withStatus('success')->with('newtoken', $token->plainTextToken)->with('application', $request->application)->with('callbackurl', $newcallbackurl); + return view("accounts.tokenwizzard_finish")->with('status', 'success')->with('newtoken', $token->plainTextToken)->with('application', $request->application)->with('callbackurl', $newcallbackurl); } @@ -188,7 +188,7 @@ public function addSso($method) return redirect('/login/steam'); break; default: - return Redirect::back()->withError('no valid sso method selected'); + return Redirect::back()->with('error', 'no valid sso method selected'); break; } } @@ -248,7 +248,7 @@ public function removeSso(Request $request, $method) break; default: - return Redirect::back()->withError('no valid sso method selected'); + return Redirect::back()->with('error', 'no valid sso method selected'); break; } } @@ -313,7 +313,7 @@ public function update(Request $request) if (!$user->save()) { return Redirect::back()->withFail("Oops, Something went Wrong."); } - return Redirect::back()->withSuccess('Account successfully updated!'); + return Redirect::back()->with('success', 'Account successfully updated!'); } public function updateMail(Request $request) diff --git a/src/app/Http/Controllers/Admin/Events/VenuesController.php b/src/app/Http/Controllers/Admin/Events/VenuesController.php index 5d0c2056..4b40c689 100644 --- a/src/app/Http/Controllers/Admin/Events/VenuesController.php +++ b/src/app/Http/Controllers/Admin/Events/VenuesController.php @@ -83,7 +83,7 @@ public function store(Request $request) } if (!$validCountry) { Session::flash('alert-danger', 'That country appears to be invalid. Please use a valid one.'); - return Redirect::back()->with('input', $request->input())->withError('That country appears to be invalid. Please use a valid one.'); + return Redirect::back()->with('input', $request->input())->with('error', 'That country appears to be invalid. Please use a valid one.'); } if (isset($request->address_postcode) && $request->address_postcode != null && trim($request->address_postcode) != '') { @@ -193,7 +193,7 @@ public function update(EventVenue $venue, Request $request) } if (!$validCountry) { Session::flash('alert-danger', 'That country appears to be invalid. Please use a valid one.'); - return Redirect::back()->with('input', $request->input())->withError('That country appears to be invalid. Please use a valid one.'); + return Redirect::back()->with('input', $request->input())->with('error', 'That country appears to be invalid. Please use a valid one.'); } if (isset($request->address_postcode) && $request->address_postcode != null && trim($request->address_postcode) != '') { diff --git a/src/app/Http/Controllers/Auth/AuthController.php b/src/app/Http/Controllers/Auth/AuthController.php index bf1d7441..c27c65f2 100644 --- a/src/app/Http/Controllers/Auth/AuthController.php +++ b/src/app/Http/Controllers/Auth/AuthController.php @@ -108,10 +108,10 @@ public function showRegister($method) ) { return redirect('/'); // redirect to site } - return view('auth.register', $user)->withLoginMethod('steam'); + return view('auth.register', $user)->with('loginMethod', 'steam'); break; default: - return view('auth.register')->withLoginMethod('standard'); + return view('auth.register')->with('loginMethod', 'standard'); break; } } @@ -211,7 +211,7 @@ public function register($method, Request $request, User $user) if (!$user->save()) { Auth::logout(); - return Redirect('/')->withError('Something went wrong. Please Try again later'); + return Redirect('/')->with('error', 'Something went wrong. Please Try again later'); } Session::forget('user'); Auth::login($user, true); diff --git a/src/app/Http/Controllers/Auth/LoginController.php b/src/app/Http/Controllers/Auth/LoginController.php index 7e274785..70047ea4 100644 --- a/src/app/Http/Controllers/Auth/LoginController.php +++ b/src/app/Http/Controllers/Auth/LoginController.php @@ -71,7 +71,7 @@ public function login(Request $request) if ($user = User::where('email', $request->email)->first()) { if ($user->banned) { Session::flash('alert-danger', 'You have been banned!'); - return Redirect::back()->withError('You have been banned.'); + return Redirect::back()->with('error', 'You have been banned.'); } } diff --git a/src/app/Http/Controllers/Auth/SteamController.php b/src/app/Http/Controllers/Auth/SteamController.php index 1d246f85..616ca09b 100644 --- a/src/app/Http/Controllers/Auth/SteamController.php +++ b/src/app/Http/Controllers/Auth/SteamController.php @@ -45,7 +45,7 @@ public function login(Request $request) if (!is_null($user)) { if ($user->banned) { Session::flash('alert-danger', 'You have been banned!'); - return Redirect::back()->withError('You have been banned.'); + return Redirect::back()->with('error', 'You have been banned.'); } //username found... Log user in Auth::login($user, true); @@ -89,7 +89,7 @@ public function login(Request $request) return $this->addtoexistingaccount($info, Auth::user()); } else { Session::flash('alert-danger', 'Another steamid is already set in your account, remove it first in your account settings!'); - return Redirect::to('/account/')->withError('Another steamid is already set in your account, remove it first in your account settings!'); + return Redirect::to('/account/')->with('error', 'Another steamid is already set in your account, remove it first in your account settings!'); } } } @@ -130,7 +130,7 @@ private function addtoexistingaccount($info, User $user) return Redirect('/account'); } Session::flash('alert-danger', 'Saving user failed!'); - return Redirect::to('/account/')->withError('Saving user failed!'); + return Redirect::to('/account/')->with('error', 'Saving user failed!'); } /** diff --git a/src/app/Http/Middleware/Banned.php b/src/app/Http/Middleware/Banned.php index e0a4e6f6..2385d8c9 100644 --- a/src/app/Http/Middleware/Banned.php +++ b/src/app/Http/Middleware/Banned.php @@ -19,6 +19,6 @@ public function handle($request, Closure $next) } Session::flash('alert-danger', 'You have been banned!'); - return Redirect::back()->withError('You have been banned.'); + return Redirect::back()->with('error', 'You have been banned.'); } }