Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix View With-Variables #937

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/app/Http/Controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -44,7 +44,7 @@ public function showMail()
$user = Auth::user();

return view("accounts.email")
->withUser($user);
->with('user', $user);
}

/**
Expand All @@ -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);
}


Expand Down Expand Up @@ -133,17 +133,17 @@ 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')->withApplication($application)->withCallbackurl($callbackurl);
return view("accounts.tokenwizzard_start")->with('status', '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);
}

/**
Expand All @@ -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")->with('status', 'del_failed')->with('application', $request->application);
}
}
}
Expand All @@ -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")->with('status', '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")->with('status', 'success')->with('newtoken', $token->plainTextToken)->with('application', $request->application)->with('callbackurl', $newcallbackurl);
}


Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -305,15 +305,15 @@ public function update(Request $request)

$user->firstname = @$request->firstname;
$user->surname = @$request->surname;

if (isset($request->locale)) {
$user->locale = @$request->locale;
}

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)
Expand Down Expand Up @@ -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')
))
Expand Down Expand Up @@ -399,5 +399,5 @@ public function update_selected_avatar(Request $request) {
return Redirect::back();
}


}
52 changes: 26 additions & 26 deletions src/app/Http/Controllers/Admin/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,31 @@ 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)
->withShopEnabled(Settings::isShopEnabled())
->withGalleryEnabled(Settings::isGalleryEnabled())
->withHelpEnabled(Settings::isHelpEnabled())
->withCreditEnabled(Settings::isCreditEnabled())
->withSupportedLoginMethods(Settings::getSupportedLoginMethods())
->withActiveLoginMethods(Settings::getLoginMethods())
->withSupportedPaymentGateways(Settings::getSupportedPaymentGateways())
->withActivePaymentGateways(Settings::getPaymentGateways())
->withFacebookCallback($facebookCallback)
->withUserLastLoggedIn($userLastLoggedIn)
->withUserCount($users->count())
->withUserLoginMethodCount($userLoginMethodCount)
->withParticipantCount($participantCount)
->withNextEvent(Helpers::getNextEventName())
->withTournamentCount($tournamentCount)
->withTournamentParticipantCount($tournamentParticipantCount)
->withOrderBreakdown($orderBreakdown)
->withTicketBreakdown($ticketBreakdown);
->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())
->with('creditEnabled', Settings::isCreditEnabled())
->with('supportedLoginMethods', Settings::getSupportedLoginMethods())
->with('activeLoginMethods', Settings::getLoginMethods())
->with('supportedPaymentGateways', Settings::getSupportedPaymentGateways())
->with('activePaymentGateways', Settings::getPaymentGateways())
->with('facebookCallback', $facebookCallback)
->with('userLastLoggedIn', $userLastLoggedIn)
->with('userCount', $users->count())
->with('userLoginMethodCount', $userLoginMethodCount)
->with('participantCount', $participantCount)
->with('nextEvent', Helpers::getNextEventName())
->with('tournamentCount', $tournamentCount)
->with('tournamentParticipantCount', $tournamentParticipantCount)
->with('orderBreakdown', $orderBreakdown)
->with('ticketBreakdown', $ticketBreakdown);
}
}
6 changes: 3 additions & 3 deletions src/app/Http/Controllers/Admin/AppearanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function index()
return false !== stristr($item->key, 'color_header');
});
return view('admin.settings.appearance')
->withSliderImages(SliderImage::getImages('frontpage'))
->withUserOverrideCss(Appearance::getCssOverride())
->withCssVariables($sortedCssVariables);
->with('sliderImages', SliderImage::getImages('frontpage'))
->with('userOverrideCss', Appearance::getCssOverride())
->with('cssVariables', $sortedCssVariables);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/app/Http/Controllers/Admin/CreditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function index()
$selectallusers[$user->id] = $user->username;
}
return view('admin.credit.index')
->withIsCreditEnabled(Settings::isCreditEnabled())
->withCreditLogs(CreditLog::paginate(10, ['*'], 'cl'))
->withUsers($selectallusers);
->with('isCreditEnabled', Settings::isCreditEnabled())
->with('creditLogs', CreditLog::paginate(10, ['*'], 'cl'))
->with('users', $selectallusers);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/app/Http/Controllers/Admin/Events/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand All @@ -43,10 +43,10 @@ public function index()
public function show(Event $event)
{
return view('admin.events.show')
->withUser(Auth::user())
->withEvent($event)
->withAnnouncements($event->announcements()->paginate(5, ['*'], 'an'))
->withParticipants($event->eventParticipants()->paginate(10, ['*'], 'ep'));
->with('user', Auth::user())
->with('event', $event)
->with('announcements', $event->announcements()->paginate(5, ['*'], 'an'))
->with('participants', $event->eventParticipants()->paginate(10, ['*'], 'ep'));
}

/**
Expand Down Expand Up @@ -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');
Expand Down
22 changes: 11 additions & 11 deletions src/app/Http/Controllers/Admin/Events/ParticipantsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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!');
Expand All @@ -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!');
Expand Down Expand Up @@ -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)) {
Expand All @@ -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!');
Expand All @@ -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!');
Expand All @@ -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');
Expand Down
Loading