diff --git a/Makefile b/Makefile index 3c8cb7e1..68b173b0 100755 --- a/Makefile +++ b/Makefile @@ -221,6 +221,7 @@ folder-structure-prd: mkdir -p /src/storage/app/public/images/venues/ && \ mkdir -p /src/storage/app/public/images/main/ && \ mkdir -p /src/storage/app/public/images/shop/ && \ + mkdir -p /src/storage/app/public/images/avatars/ && \ mkdir -p /src/storage/app/public/attachments/help/" folder-structure-dev: @@ -232,6 +233,7 @@ folder-structure-dev: mkdir -p /src/storage/app/public/images/venues/ && \ mkdir -p /src/storage/app/public/images/main/ && \ mkdir -p /src/storage/app/public/images/shop/ && \ + mkdir -p /src/storage/app/public/images/avatars/ && \ mkdir -p /src/storage/app/public/attachments/help/" # Create SSL Keypair for Development @@ -426,6 +428,7 @@ purge-files: touch /src/public/css/images/.gitkeep; \ rm -rf /src/storage/app/public/images/gallery ; \ rm -rf /src/storage/app/public/images/events ; \ + rm -rf /src/storage/app/public/images/avatars ; \ rm -rf /src/storage/app/public/images/venues ; \ rm -rf /src/storage/app/public/images/main ; \ rm -rf /src/storage/user/scss/*.css ; \ diff --git a/currentchangelog b/currentchangelog index 1a18359a..294c02b7 100644 --- a/currentchangelog +++ b/currentchangelog @@ -1,3 +1,7 @@ +-Added Change for Events Venue after creating +-Added iCal for Events Information +-Added Tournament Participation Control for Staff and Freebie Event Participants +-Added Partials for Event Information, Event Information Card, Sponsors, Seating -Added Multilanguage support on a per site bases -Added Translation to german -Added Gameserver Management per game (includes a management/Rcon feature and a api for the CS:go tournament plugin Get5) diff --git a/src/app/Event.php b/src/app/Event.php index 2169a1c0..d041b6fe 100644 --- a/src/app/Event.php +++ b/src/app/Event.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; +use Carbon\Carbon; use Cviebrock\EloquentSluggable\Sluggable; @@ -37,7 +38,11 @@ class Event extends Model 'seating_cap', 'spectator_cap', 'ticket_spectator', - 'ticket_weekend' + 'ticket_weekend', + 'private_participants', + 'matchmaking_enabled', + 'tournaments_freebies', + 'tournaments_staff' ]; /** @@ -87,6 +92,36 @@ protected static function boot() } } + + /** + * Scope a query to get the next upcoming event(s). + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $limit + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeNextUpcoming(Builder $query, int $limit = 1): Builder + { + return $query->where('end', '>=', Carbon::now()) + ->orderByRaw('ABS(DATEDIFF(events.end, NOW()))') + ->limit($limit); + } + + /** + * Scope a query to get the current active event(s). + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Carbon\Carbon|null $now + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeCurrent(Builder $query, Carbon $now = null): Builder + { + $now = $now ?? Carbon::now(); + return $query->where('start', '<', $now) + ->where('end', '>', $now) + ->orderBy('id', 'desc'); + } + /* * Relationships */ @@ -330,4 +365,33 @@ public function addTagById($tag) } return true; } + + /** + * Get if Event is currently running + * @return Boolean + */ + public function isRunningCurrently() + { + return $this->isRunningOn(Carbon::now()); + } + + /** + * Get if Event is running on a specific date + * @param Carbon $date + * @return Boolean + */ + public function isRunningOn(Carbon $date) + { + return $date->between(Carbon::create($this->start),Carbon::create($this->end)); + } + + /** + * Get if Event has already ended + * @return Boolean + */ + public function hasEnded() + { + return Carbon::create($this->end)->greaterThan(Carbon::now()); + } + } diff --git a/src/app/EventParticipant.php b/src/app/EventParticipant.php index cbfdd10d..5803474e 100644 --- a/src/app/EventParticipant.php +++ b/src/app/EventParticipant.php @@ -39,6 +39,8 @@ class EventParticipant extends Model 'event_id', 'ticket_id', 'purchase_id', + 'staff', + 'free', ]; public static function boot() @@ -137,18 +139,15 @@ public function getGiftedByUser() */ public function generateQRCode($forcenewname = false) { - if(Str::startsWith(config('app.url'), ['http://', 'https://'])) { + if (Str::startsWith(config('app.url'), ['http://', 'https://'])) { $ticketUrl = config('app.url') . '/tickets/retrieve/' . $this->id; } else { $ticketUrl = 'https://' . config('app.url') . '/tickets/retrieve/' . $this->id; } - if (isset($this->qrcode) && $this->qrcode != "" && !$forcenewname) - { + if (isset($this->qrcode) && $this->qrcode != "" && !$forcenewname) { $qrCodeFullPath = $this->qrcode; - } - else - { + } else { $qrCodePath = 'storage/images/events/' . $this->event->slug . '/qr/'; $qrCodeFileName = $this->event->slug . '-' . Str::random(32) . '.png'; if (!file_exists($qrCodePath)) { @@ -203,7 +202,8 @@ public static function getNewParticipants($type = 'all') return $particpants; } - public function getPdf(): string { + public function getPdf(): string + { $user = Auth::user(); $data = new \stdClass(); // TODO: Probably don't use str_replace @@ -253,10 +253,22 @@ function setRevoked() if (!$this->seat) { return $this->save(); } - if (!$this->seat->delete()) { + if (!$this->seat->delete() || !$this->setSignIn(false)) { $this->revoked = false; return false; } return $this->save(); } + + /** + * Check if participant is active + * @return Boolean + */ + public function isActive() + { + + return ($this->signed_in || $this->event->online_event) && + ($this->free || $this->staff || $this->purchase->status == "Success") && + (!$this->revoked); + } } diff --git a/src/app/EventTimetableData.php b/src/app/EventTimetableData.php index 7b7aad2e..bfd76dd9 100644 --- a/src/app/EventTimetableData.php +++ b/src/app/EventTimetableData.php @@ -5,6 +5,8 @@ use App\EventTimetable; use App\Http\Requests; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; + class EventTimetableData extends Model { @@ -22,4 +24,14 @@ public function timetable() { return $this->belongsTo('App\EventTimetable'); } + + + protected static function boot() + { + parent::boot(); + + static::addGlobalScope('start_time', function (Builder $builder) { + $builder->orderBy('start_time', 'asc'); + }); + } } diff --git a/src/app/Http/Controllers/AccountController.php b/src/app/Http/Controllers/AccountController.php index f43e878d..bba27d05 100644 --- a/src/app/Http/Controllers/AccountController.php +++ b/src/app/Http/Controllers/AccountController.php @@ -7,8 +7,11 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Redirect; use Session; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; use Settings; +use App\Rules\ValidLocale; class AccountController extends Controller { @@ -236,7 +239,13 @@ public function removeSso(Request $request, $method) case 'steam': $user->steamname = ""; $user->steamid = ""; - $user->avatar = ""; + $user->steam_avatar = ""; + + if ($user->selected_avatar == 'steam') + { + $user->selected_avatar = 'local'; + } + break; default: return Redirect::back()->withError('no valid sso method selected'); @@ -267,6 +276,7 @@ public function update(Request $request) 'surname' => 'filled', 'password1' => 'same:password2', 'password2' => 'same:password1', + 'locale' => ['nullable', new ValidLocale] ]; $messages = [ 'firstname.filled' => 'Firstname Cannot be blank.', @@ -295,6 +305,10 @@ 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."); @@ -343,4 +357,47 @@ public function updateMail(Request $request) } return redirect('/'); } + + 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') + )) + { + Session::flash('alert-danger', 'Oops,Something went wrong while uploading the File on the custom avatar upload.'); + return Redirect::back(); + } + $user = Auth::user(); + $user->local_avatar = '/storage/images/avatars/' . basename($path); + $user->selected_avatar = 'local'; + if (!$user->save()) { + Session::flash('alert-danger', 'Oops, Something went wrong while updating the user on the custom avatar upload.'); + return Redirect::back(); + } + + Session::flash('alert-success', 'Custom avatar successfully updated!'); + return Redirect::back(); + } + + public function update_selected_avatar(Request $request) { + + $this->validate($request, [ + 'selected_avatar' => 'required|in:steam,local', + ]); + + $user = Auth::user(); + $user->selected_avatar = $request->selected_avatar; + if (!$user->save()) { + Session::flash('alert-danger', 'Oops, Something went wrong while updating the user on the selected avatar change.'); + return Redirect::back(); + } + + Session::flash('alert-success', 'Selected avatar successfully updated!'); + return Redirect::back(); + } + + } diff --git a/src/app/Http/Controllers/Admin/Events/EventsController.php b/src/app/Http/Controllers/Admin/Events/EventsController.php index d62a4684..e50131cf 100644 --- a/src/app/Http/Controllers/Admin/Events/EventsController.php +++ b/src/app/Http/Controllers/Admin/Events/EventsController.php @@ -12,6 +12,8 @@ use App\EventParticipant; use App\EventTicket; use App\EventAnnouncement; +use App\EventVenue; +use App\Purchase; use App\Http\Requests; use App\Http\Controllers\Controller; @@ -98,6 +100,8 @@ public function store(Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); + $event->tournaments_freebies = ($request->tournaments_freebies ? true : false); + $event->tournaments_staff = ($request->tournaments_staff ? true : false); if (!$event->save()) { Session::flash('alert-danger', 'Cannot Save Event!'); @@ -193,11 +197,17 @@ public function update(Event $event, Request $request) $event->online_event = ($request->online_event ? true : false); $event->private_participants = ($request->private_participants ? true : false); $event->matchmaking_enabled = ($request->matchmaking_enabled ? true : false); + $event->tournaments_freebies = ($request->tournaments_freebies ? true : false); + $event->tournaments_staff = ($request->tournaments_staff ? true : false); if (isset($request->capacity)) { $event->capacity = $request->capacity; } + if (isset($request->venue)) { + $event->event_venue_id = @$request->venue; + } + if (!$event->save()) { Session::flash('alert-danger', 'Cannot update Event!'); return Redirect::to('admin/events/' . $event->slug); @@ -236,13 +246,27 @@ public function destroy(Event $event) */ public function freeGift(Request $request, Event $event) { + $purchase = new Purchase(); + $purchase->user_id = $request->user_id; + $purchase->type = 'system'; + $purchase->status = "Success"; + $purchase->transaction_id = "Granted by ". $request->user()->username; + + $purchase->setSuccess(); + + if (!$purchase->save()) { + Session::flash('alert-danger', 'Could not save "system" purchase!'); + } + $participant = new EventParticipant(); $participant->user_id = $request->user_id; $participant->event_id = $event->id; $participant->free = 1; $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'); @@ -253,27 +277,40 @@ public function freeGift(Request $request, Event $event) } /** - * Add Admin Participant + * Add Staff Participant * @param Request $request * @param Event $event * @return Redirect */ public function freeStaff(Request $request, Event $event) { + $purchase = new Purchase(); + $purchase->user_id = $request->user_id; + $purchase->type = 'system'; + $purchase->status = "Success"; + $purchase->transaction_id = "Appointed by ". $request->user()->username; + + $purchase->setSuccess(); + + if (!$purchase->save()) { + Session::flash('alert-danger', 'Could not save "system" purchase!'); + } + $participant = new EventParticipant(); $participant->user_id = $request->user_id; $participant->event_id = $event->id; $participant->staff = 1; $participant->staff_free_assigned_by = Auth::id(); + $participant->purchase_id = $purchase->id; $participant->generateQRCode(); if (!$participant->save()) { - Session::flash('alert-danger', 'Could not add Admin!'); + Session::flash('alert-danger', 'Could not add Staff!'); return Redirect::to('admin/events/' . $event->slug . '/tickets'); } - Session::flash('alert-success', 'Successfully added Admin!'); + Session::flash('alert-success', 'Successfully added Staff!'); return Redirect::to('admin/events/' . $event->slug . '/tickets'); } } diff --git a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php index d197598c..71b5ab01 100644 --- a/src/app/Http/Controllers/Admin/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Admin/Events/ParticipantsController.php @@ -63,20 +63,34 @@ public function update(Event $event, EventParticipant $participant, Request $req */ 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/'); + } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); } + if ($participant->revoked) { + Session::flash('alert-danger', 'Cannot sign in a revoked Participant!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + } if (!$participant->setSignIn()) { Session::flash('alert-danger', 'Cannot sign in Participant!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); } Session::flash('alert-success', 'Participant Signed in!'); - return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); } public function transfer(Event $event, EventParticipant $participant, Request $request) { + 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/'); + } if ($participant->ticket && $participant->purchase->status != "Success") { Session::flash('alert-danger', 'Cannot sign in Participant because the payment is not completed!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -120,8 +134,39 @@ public function signoutall(Event $event) return Redirect::to('admin/events/' . $event->slug . '/participants/'); } + /** + * Sign out a single participant for the event + * @param Event $event + * @param EventParticipant $participant + * @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/'); + } + if ($participant->revoked) { + Session::flash('alert-danger', 'Cannot sign out a revoked Participant!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); + } + if (!$participant->setSignIn(false)) { + Session::flash('alert-danger', 'Cannot sign out Participant! '. $participant->name); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } + + Session::flash('alert-success', 'Participant ' . $participant->name . ' signed out!'); + return Redirect::to('admin/events/' . $event->slug . '/participants/'); + } + 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/'); + } if (!$participant->setRevoked()) { Session::flash('alert-danger', 'Cannot revoke Participant!'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); @@ -132,6 +177,11 @@ function revoke(Event $event, EventParticipant $participant) 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/'); + } if (!$participant->delete()) { Session::flash('alert-danger', 'Cannot delete participant'); return Redirect::to('admin/events/' . $event->slug . '/participants/' . $participant->id); diff --git a/src/app/Http/Controllers/Admin/Events/TicketsController.php b/src/app/Http/Controllers/Admin/Events/TicketsController.php index 401b510d..9d4570b4 100644 --- a/src/app/Http/Controllers/Admin/Events/TicketsController.php +++ b/src/app/Http/Controllers/Admin/Events/TicketsController.php @@ -27,9 +27,26 @@ class TicketsController extends Controller */ public function index(Event $event) { + $users = User::all(); + $systemtickets = $users->sortByDesc(function($user) use ($event) { + return [ + $user->getFreeTickets($event->id)->count(), + $user->getStaffTickets($event->id)->count() + ]; + })->values(); + $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) - ->withUsers(User::all()); + ->withTotalFreeTickets($totalFreeTickets) + ->withTotalStaffTickets($totalStaffTickets) + ->withUsers($users); } /** diff --git a/src/app/Http/Controllers/Admin/Events/TimetablesController.php b/src/app/Http/Controllers/Admin/Events/TimetablesController.php index 1cfbb331..45766257 100644 --- a/src/app/Http/Controllers/Admin/Events/TimetablesController.php +++ b/src/app/Http/Controllers/Admin/Events/TimetablesController.php @@ -29,12 +29,6 @@ class TimetablesController extends Controller */ public function index(Event $event) { - foreach ($event->timetables as $timetable) { - $timetable->data = EventTimetableData::where('event_timetable_id', $timetable->id) - ->orderBy('start_time', 'asc') - ->get(); - } - return view('admin.events.timetables.index') ->withEvent($event); } diff --git a/src/app/Http/Controllers/Admin/GamesController.php b/src/app/Http/Controllers/Admin/GamesController.php index c49546a1..1a46858e 100644 --- a/src/app/Http/Controllers/Admin/GamesController.php +++ b/src/app/Http/Controllers/Admin/GamesController.php @@ -219,7 +219,10 @@ public function update(Game $game, Request $request) } if ($request->file('image_thumbnail')) { - Storage::delete($game->image_thumbnail_path); + // Check if the image exists in storage before attempting to delete + if ($game->image_thumbnail_path && Storage::exists($game->image_thumbnail_path)) { + Storage::delete($game->image_thumbnail_path); + } $imageName = 'thumbnail.' . $request->file('image_thumbnail')->getClientOriginalExtension(); Image::read($request->file('image_thumbnail')) ->resize(500, 500) @@ -232,7 +235,10 @@ public function update(Game $game, Request $request) } if ($request->file('image_header')) { - Storage::delete($game->image_header_path); + // Check if the image exists in storage before attempting to delete + if ($game->image_header_path && Storage::exists($game->image_header_path)) { + Storage::delete($game->image_header_path); + } $imageName = 'header.' . $request->file('image_header')->getClientOriginalExtension(); Image::read($request->file('image_header')) ->resize(1600, 400) diff --git a/src/app/Http/Controllers/Admin/SettingsController.php b/src/app/Http/Controllers/Admin/SettingsController.php index 8f28f017..a8fcff6c 100644 --- a/src/app/Http/Controllers/Admin/SettingsController.php +++ b/src/app/Http/Controllers/Admin/SettingsController.php @@ -24,6 +24,9 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; +use Illuminate\Support\Facades\Validator; + +use App\Rules\ValidLocale; use function PHPUnit\Framework\isEmpty; @@ -306,7 +309,9 @@ public function update(Request $request) 'event_count_offset' => 'numeric', 'org_logo' => 'image', 'org_favicon' => 'image', + 'site_locale' => ['nullable', new ValidLocale] ]; + $messages = [ 'terms_and_conditions.filled' => 'Terms And Conditions cannot be empty', 'org_name.filled' => 'Org Name cannot be empty', @@ -322,7 +327,7 @@ public function update(Request $request) 'participant_count_offset.numeric' => 'Participant Count Offset must be a number', 'event_count_offset.numeric' => 'Lan Count Offset must be a number', 'org_logo.image' => 'Org Logo must be a Image', - 'org_favicon' => 'Org Favicon must be a Image' + 'org_favicon' => 'Org Favicon must be a Image', ]; $this->validate($request, $rules, $messages); @@ -709,6 +714,51 @@ public function disableMatchMakingSystem() return Redirect::back(); } + /** + * Enable UserLocale + * @return Redirect + */ + public function enableUserLocale() + { + if (!Settings::enableUserLocale()) { + Session::flash('alert-danger', "Could not Enable UserLocale!"); + return Redirect::back(); + } + Session::flash('alert-success', "Successfully Enabled UserLocale!"); + return Redirect::back(); + } + + /** + * Disable UserLocale + * @return Redirect + */ + public function disableUserLocale() + { + if (!Settings::disableUserLocale()) { + Session::flash('alert-danger', "Could not Disable UserLocale!"); + return Redirect::back(); + } + Session::flash('alert-success', "Successfully Disabled UserLocale!"); + return Redirect::back(); + } + + + /** + * Resets UserLocale of all users to current Site Locale + * @return Redirect + */ + public function resetUserLocales() + { + $count = 0; + foreach (User::all() as $user) { + $user->locale = Settings::getSiteLocale(); + $user->save(); + $count++; + } + Session::flash('alert-success', 'Successfully resetted userlocale to ' . Settings::getSiteLocale() . ' on ' . $count . ' Users!'); + return Redirect::back(); + } + /** * Enable Login Method diff --git a/src/app/Http/Controllers/Admin/UsersController.php b/src/app/Http/Controllers/Admin/UsersController.php index 0e8567a8..f4023ba9 100644 --- a/src/app/Http/Controllers/Admin/UsersController.php +++ b/src/app/Http/Controllers/Admin/UsersController.php @@ -27,20 +27,20 @@ class UsersController extends Controller */ public function index(Request $request) { - if ($request->searchquery != "") - { + if ($request->searchquery != "") { return view('admin.users.index') - ->withUser(Auth::user()) - ->withUsers(User::where('username', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('firstname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('surname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('username_nice', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('steamname', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('email', 'LIKE', '%'.$request->searchquery.'%') - ->orWhere('phonenumber', 'LIKE', '%'.$request->searchquery.'%') - ->paginate(20)->appends(['searchquery' => $request->searchquery]) - - ); + ->withUser(Auth::user()) + ->withUsers( + User::where('username', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('firstname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('surname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('username_nice', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('steamname', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('email', 'LIKE', '%' . $request->searchquery . '%') + ->orWhere('phonenumber', 'LIKE', '%' . $request->searchquery . '%') + ->paginate(20)->appends(['searchquery' => $request->searchquery]) + + ); } return view('admin.users.index') @@ -154,7 +154,10 @@ public function unauthorizeThirdparty(User $user, String $method) case 'steam': $user->steamname = null; $user->steamid = null; - $user->avatar = null; + $user->steam_avatar = null; + if ($user->selected_avatar == 'steam') { + $user->selected_avatar = 'local'; + } break; default: Session::flash('alert-danger', 'Cannot remove thirdparty authentication, no method selected!!'); diff --git a/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php b/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php index 418ee20a..a0197afe 100644 --- a/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php +++ b/src/app/Http/Controllers/Adminapi/Events/ParticipantsController.php @@ -81,6 +81,13 @@ public function getParticipant(EventParticipant $participant) */ public function signIn(EventParticipant $participant) { + if ($participant->revoked) { + return [ + 'successful' => false, + 'reason' => 'Cannot sign in revoked Participant', + 'participant' => $participant, + ]; + } if (!$participant->setSignIn()) { return [ 'successful' => false, diff --git a/src/app/Http/Controllers/Auth/AuthController.php b/src/app/Http/Controllers/Auth/AuthController.php index 69fa7859..caae0fa6 100644 --- a/src/app/Http/Controllers/Auth/AuthController.php +++ b/src/app/Http/Controllers/Auth/AuthController.php @@ -103,7 +103,7 @@ public function showRegister($method) if ( is_null($user['steamid']) || - is_null($user['avatar']) || + is_null($user['steam_avatar']) || is_null($user['steamname']) ) { return redirect('/'); // redirect to site @@ -152,7 +152,8 @@ public function register($method, Request $request, User $user) $this->validate($request, $validationRules); - $user->avatar = $request->avatar; + $user->steam_avatar = $request->avatar; + $user->selected_avatar = 'steam'; $user->steamid = $request->steamid; $user->steamname = $request->steamname; @@ -197,6 +198,7 @@ public function register($method, Request $request, User $user) $this->validate($request, $rules, $messages); $user->email = $request->email; $user->password = Hash::make($request->password1); + $user->selected_avatar = 'local'; break; } @@ -204,6 +206,8 @@ public function register($method, Request $request, User $user) $user->surname = $request->surname; $user->username = $request->username; $user->username_nice = strtolower(str_replace(' ', '-', $request->username)); + $user->locale = Settings::getSiteLocale(); + if (!$user->save()) { Auth::logout(); diff --git a/src/app/Http/Controllers/Auth/LoginController.php b/src/app/Http/Controllers/Auth/LoginController.php index 916618f8..7e274785 100644 --- a/src/app/Http/Controllers/Auth/LoginController.php +++ b/src/app/Http/Controllers/Auth/LoginController.php @@ -2,6 +2,9 @@ namespace App\Http\Controllers\Auth; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Cookie; + use Session; use Settings; @@ -71,8 +74,9 @@ public function login(Request $request) return Redirect::back()->withError('You have been banned.'); } } - if ($this->attemptLogin($request)) { + + if ($this->attemptLogin($request)) { if ((!isset($user->phonenumber) || $user->phonenumber == null) && Settings::isAuthRequirePhonenumberEnabled()) { return redirect('/account/email'); // redirect to site } diff --git a/src/app/Http/Controllers/Auth/SteamController.php b/src/app/Http/Controllers/Auth/SteamController.php index 7b5e9aa1..a4c4e042 100644 --- a/src/app/Http/Controllers/Auth/SteamController.php +++ b/src/app/Http/Controllers/Auth/SteamController.php @@ -53,8 +53,8 @@ public function login(Request $request) if ($info->personaname != $user->steamname) { $user->steamname = $info->personaname; } - if ($info->avatarfull != $user->avatar) { - $user->avatar = $info->avatarfull; + if ($info->avatarfull != $user->steam_avatar) { + $user->steam_avatar = $info->avatarfull; } $user->last_login = Carbon::now()->toDateTimeString(); $user->save(); @@ -78,7 +78,7 @@ public function login(Request $request) if (!Auth::user()) { $user = [ 'steamname' => $info->personaname, - 'avatar' => $info->avatarfull, + 'steam_avatar' => $info->avatarfull, 'steamid' => $info->steamID64, ]; Session::put('user', $user); @@ -121,7 +121,9 @@ private function addtoexistingaccount($info, User $user) } $user->steamname = $info->personaname; - $user->avatar = $info->avatarfull; + $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 5d728256..d36e331b 100644 --- a/src/app/Http/Controllers/Events/EventsController.php +++ b/src/app/Http/Controllers/Events/EventsController.php @@ -6,6 +6,8 @@ use Auth; use Helpers; +use App\Setting; + use App\Event; use App\EventTimetable; use App\EventTimetableData; @@ -15,6 +17,8 @@ use App\Http\Requests; use App\Http\Controllers\Controller; +use Carbon\Carbon; + use Illuminate\Http\Request; use Illuminate\Support\Facades\Redirect; @@ -77,7 +81,51 @@ public function show(Event $event) SEOMeta::addKeyword($seoKeywords); OpenGraph::setDescription(Helpers::getSeoCustomDescription($event->desc_short)); OpenGraph::addProperty('type', 'article'); + return view('events.show') ->withEvent($event); } + + /** + * Generate ICS element for download + * @param Event $event + * @return ICS Text File + */ + public function generateICS(Event $event) + { + $eventStart = Carbon::parse($event->start)->format('Ymd\THis\Z'); + $eventEnd = Carbon::parse($event->end)->format('Ymd\THis\Z'); + $orgName = Setting::getOrgName(); + $eventName = $event->display_name; + $eventDescription = strip_tags((string) $event->desc_long); + $venue = $event->venue; + $addressParts = [ + $venue->address_1, + $venue->address_2, + $venue->address_street, + $venue->address_city, + $venue->address_postcode, + $venue->address_country + ]; + $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"; + $icsContent .= "BEGIN:VEVENT\r\n"; + $icsContent .= "UID:" . uniqid() . "\r\n"; + $icsContent .= "DTSTAMP:" . gmdate('Ymd\THis\Z') . "\r\n"; + $icsContent .= "DTSTART:" . $eventStart . "\r\n"; + $icsContent .= "DTEND:" . $eventEnd . "\r\n"; + $icsContent .= "SUMMARY:" . $eventName . "\r\n"; + $icsContent .= "DESCRIPTION:" . $eventDescription . "\r\n"; + $icsContent .= "LOCATION:" . $address . "\r\n"; + $icsContent .= "END:VEVENT\r\n"; + $icsContent .= "END:VCALENDAR\r\n"; + + return response($icsContent, 200) + ->header('Content-Type', 'text/calendar; charset=utf-8') + ->header('Content-Disposition', 'attachment; filename="event.ics"'); + } } diff --git a/src/app/Http/Controllers/Events/TournamentsController.php b/src/app/Http/Controllers/Events/TournamentsController.php index 3ad368cb..30f63a81 100644 --- a/src/app/Http/Controllers/Events/TournamentsController.php +++ b/src/app/Http/Controllers/Events/TournamentsController.php @@ -72,6 +72,8 @@ 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()) { Session::flash('alert-danger', __('events.tournament_not_signed_in')); @@ -103,6 +105,20 @@ public function registerSingle(Event $event, EventTournament $tournament, Reques } + // Get the EventParticipant only Once is better? + $eventParticipant = $event->eventParticipants()->where('id', $request->event_participant_id)->first(); + // Check if staff is trying to register + if ($eventParticipant->staff && !$event->tournaments_staff) { + 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')); + return Redirect::back(); + } + // TODO - Refactor $tournamentParticipant = new EventTournamentParticipant(); $tournamentParticipant->event_participant_id = $request->event_participant_id; diff --git a/src/app/Http/Controllers/HomeController.php b/src/app/Http/Controllers/HomeController.php index d7e526f8..3caf0058 100644 --- a/src/app/Http/Controllers/HomeController.php +++ b/src/app/Http/Controllers/HomeController.php @@ -23,6 +23,8 @@ use App\Http\Requests; +use Carbon\Carbon; + use Illuminate\Http\Request; use Illuminate\Support\Facades\Redirect; @@ -43,90 +45,38 @@ class HomeController extends Controller */ public function index() { - - // Check for Event $user = Auth::user(); - if ($user && !empty($user->eventParticipants)) { - foreach ($user->eventParticipants as $participant) { - Debugbar::addMessage("Participant: " . json_encode($participant), 'Event'); - if ((date('Y-m-d H:i:s') >= $participant->event->start) && - (date('Y-m-d H:i:s') <= $participant->event->end) && - ($participant->signed_in || $participant->event->online_event) && - ($participant->free || $participant->staff || $participant->purchase->status == "Success")) - { - Debugbar::addMessage("Participant gets event", 'Event'); + // redirect to home page if no event participants are available + if (!$user || empty($user->eventParticipants)) { + return $this->home(); + } - return $this->event(); - } + // 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()) { + return $this->event(); } } - return $this->net(); + + // redirect to home page by default + return $this->home(); } + + /** - * Show New Page + * Show Home Page * @return View */ - public function net() + public function home() { - $topAttendees = array(); - foreach (EventParticipant::groupBy('user_id', 'event_id')->get() as $attendee) { - if ($attendee->event && $attendee->event->status == 'PUBLISHED' && $attendee->event->end < \Carbon\Carbon::today()) { - $recent = false; - if (!$attendee->user->admin && array_key_exists($attendee->user->id, $topAttendees)) { - $topAttendees[$attendee->user->id]->event_count++; - $recent = true; - } - if (!$attendee->user->admin && !$recent) { - $attendee->user->event_count = 1; - $topAttendees[$attendee->user->id] = $attendee->user; - } - } - } - usort($topAttendees, function ($a, $b) { - return $b['event_count'] <=> $a['event_count']; - }); - - $topWinners = array(); - foreach (EventTournamentTeam::where('final_rank', 1)->get() as $winner_team) { - $recent = false; - foreach ($winner_team->tournamentParticipants as $winner) { - if (array_key_exists($winner->eventParticipant->user->id, $topWinners)) { - $topWinners[$winner->eventParticipant->user->id]->win_count++; - $recent = true; - } - if (!$recent) { - $winner->eventParticipant->user->win_count = 1; - $topWinners[$winner->eventParticipant->user->id] = $winner->eventParticipant->user; - } - } - } - foreach (EventTournamentParticipant::where('final_rank', 1)->get() as $winner) { - $recent = false; - if (array_key_exists($winner->eventParticipant->user->id, $topWinners)) { - $topWinners[$winner->eventParticipant->user->id]->win_count++; - $recent = true; - } - if (!$recent) { - $winner->eventParticipant->user->win_count = 1; - $topWinners[$winner->eventParticipant->user->id] = $winner->eventParticipant->user; - } - } - usort($topWinners, function ($a, $b) { - return $b['win_count'] <=> $a['win_count']; - }); - - $gameServerList = Helpers::getPublicGameServers(); - return view("home") - ->withNextEvent( - Event::where('end', '>=', \Carbon\Carbon::now()) - ->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first() - ) - ->withTopAttendees(array_slice($topAttendees, 0, 5)) - ->withTopWinners(array_slice($topWinners, 0, 5)) - ->withGameServerList($gameServerList) - ->withNewsArticles(NewsArticle::limit(2)->orderBy('created_at', 'desc')->get()) + ->withNextEvent(Event::nextUpcoming()->first()) + ->withTopAttendees(Helpers::getTopAttendees()) + ->withTopWinners(Helpers::getTopWinners()) + ->withGameServerList(Helpers::getPublicGameServers()) + ->withNewsArticles(NewsArticle::latestArticles()->get()) ->withEvents(Event::all()) ->withSliderImages(SliderImage::getImages('frontpage')) ; @@ -176,16 +126,19 @@ public function event() { $signedIn = true; $gameServerList = Helpers::getCasualGameServers(); - $event = Event::where('start', '<', date("Y-m-d H:i:s"))->where('end', '>', date("Y-m-d H:i:s"))->orderBy('id', 'desc')->first(); - $event->load('eventParticipants.user'); - $event->load('timetables'); - foreach ($event->timetables as $timetable) { - $timetable->data = EventTimetableData::where('event_timetable_id', $timetable->id) - ->orderBy('start_time', 'asc') - ->get(); + $event = Event::current()->first(); + // Check if event is null and handle it + if (!$event) { + return redirect()->route('home.index')->with('error', 'No active event found.'); } + // Loading can be done like this in one call of load function + $event->load( + 'eventParticipants.user', + ); + + // TODO - Refactor $user = Auth::user(); if ($user) { @@ -207,7 +160,6 @@ public function event() $currentuser = Auth::id(); $openpublicmatches = MatchMaking::where(['ispublic' => 1, 'status' => 'OPEN'])->orderByDesc('created_at')->paginate(4, ['*'], 'openpubmatches'); - // $liveclosedpublicmatches = MatchMaking::where(['ispublic' => 1, 'status' => 'WAITFORPLAYERS'])->orWhere(['ispublic' => 1, 'status' => 'LIVE'])->orWhere(['ispublic' => 1, 'status' => 'COMPLETE'])->orderByDesc('created_at')->paginate(4, ['*'], 'closedpubmatches'); $liveclosedpublicmatches = MatchMaking::where(function ($query) { $query->where('ispublic', 1); $query->where('status', 'WAITFORPLAYERS'); @@ -218,15 +170,13 @@ public function event() $query->where('ispublic', 1); $query->where('status', 'COMPLETE'); })->orderByDesc('created_at')->paginate(4, ['*'], 'closedpubmatches');; - + $ownedmatches = MatchMaking::where(['owner_id' => $currentuser])->orderByDesc('created_at')->paginate(4, ['*'], 'owenedpage')->fragment('ownedmatches'); $memberedteams = Auth::user()->matchMakingTeams()->orderByDesc('created_at')->paginate(4, ['*'], 'memberedmatches')->fragment('memberedmatches'); $currentuseropenlivependingdraftmatches = array(); - - foreach (MatchMaking::where(['status' => 'OPEN'])->orWhere(['status' => 'LIVE'])->orWhere(['status' => 'DRAFT'])->orWhere(['status' => 'PENDING'])->get() as $match) - { - if ($match->getMatchTeamPlayer(Auth::id())) - { + + foreach (MatchMaking::where(['status' => 'OPEN'])->orWhere(['status' => 'LIVE'])->orWhere(['status' => 'DRAFT'])->orWhere(['status' => 'PENDING'])->get() as $match) { + if ($match->getMatchTeamPlayer(Auth::id())) { $currentuseropenlivependingdraftmatches[$match->id] = $match->id; } } diff --git a/src/app/Http/Kernel.php b/src/app/Http/Kernel.php index 4eb56e0f..f110f6e7 100644 --- a/src/app/Http/Kernel.php +++ b/src/app/Http/Kernel.php @@ -29,6 +29,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, + \App\Http\Middleware\LanguageSwitcher::class, \App\Http\Middleware\Legacywarning::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, @@ -69,7 +70,6 @@ class Kernel extends HttpKernel 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'language' => \App\Http\Middleware\LanguageSwitcher::class, 'gameserver' => \App\Http\Middleware\Gameserver::class, ]; } diff --git a/src/app/Http/Middleware/LanguageSwitcher.php b/src/app/Http/Middleware/LanguageSwitcher.php index dee5cc85..0311339f 100644 --- a/src/app/Http/Middleware/LanguageSwitcher.php +++ b/src/app/Http/Middleware/LanguageSwitcher.php @@ -6,7 +6,9 @@ use Session; use App; use Config; -use App\Setting; +use Illuminate\Support\Facades\Auth; +use App\Libraries\Helpers; +use App\Libraries\Settings; class LanguageSwitcher { @@ -19,15 +21,25 @@ class LanguageSwitcher */ public function handle($request, Closure $next) { - if ($locale = Setting::getSiteLocale()) - { - $locale_dirs = array_filter(glob(app()->langPath().'/*'), 'is_dir'); - if(in_array(app()->langPath().'/'.$locale, $locale_dirs)) - { - App::setLocale($locale); + $setlocale = config('app.locale'); + if ($locale = Settings::getSiteLocale()) { + + if (!empty($locale) && Helpers::isValidLocale($locale)) { + $setlocale = $locale; } } + if (Auth::check() && Auth::user() && Settings::isUserLocaleEnabled()) { + if ($userLocale = Auth::user()->locale) { + if (!empty($userLocale) && Helpers::isValidLocale($userLocale)) { + $setlocale = $userLocale; + } + } + } + + app()->setLocale($setlocale); + app()->setFallbackLocale(config('app.fallback_locale')); + return $next($request); } } diff --git a/src/app/Http/routes.php b/src/app/Http/routes.php index ea6ec809..d9ce1567 100644 --- a/src/app/Http/routes.php +++ b/src/app/Http/routes.php @@ -24,711 +24,709 @@ Route::group(['middleware' => ['installed']], function () { - - Route::group(['middleware' => 'language'], function () { - - - - - - /** - * API - */ - Route::group(['middleware' => ['api', 'nodebugbar']], function () { - Route::get('/api/events/', 'Api\Events\EventsController@index'); - Route::get('/api/events/upcoming', 'Api\Events\EventsController@showUpcoming'); - Route::get('/api/events/{event}', 'Api\Events\EventsController@show'); - Route::get('/api/events/{event}/participants', 'Api\Events\ParticipantsController@index'); - Route::get('/api/events/{event}/timetables', 'Api\Events\TimetablesController@index'); - Route::get('/api/events/{event}/timetables/{timetable}', 'Api\Events\TimetablesController@show'); - Route::get('/api/events/{event}/tickets', 'Api\Events\TicketsController@index'); - Route::get('/api/events/{event}/tickets/{ticket}', 'Api\Events\TicketsController@show'); - - Route::group(['middleware' => ['auth:sanctum']], function () { - /** - * User API - */ - Route::get('/api/user/me', 'Userapi\MeController@getMe'); - Route::get('/api/user/event/participants', 'Userapi\Events\ParticipantsController@getParticipants'); - - /** - * Gameserver API - */ - Route::group(['middleware' => ['gameserver']], function () { - Route::post('/api/matchmaking/{match}/demo/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchDemo'); - Route::post('/api/matchmaking/{match}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFreeServer'); - Route::post('/api/matchmaking/{match}/finalize/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalize'); - Route::post('/api/matchmaking/{match}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalizeMap'); - Route::post('/api/matchmaking/{match}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchGolive'); - Route::post('/api/matchmaking/{match}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateround'); - Route::post('/api/matchmaking/{match}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateplayer'); - Route::get('/api/matchmaking/{match}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchConfig'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/demo/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchDemo'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFreeServer'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalize'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalizeMap'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchGolive'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateround'); - Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateplayer'); - Route::get('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchConfig'); - - }); - - /** - * Admin API - */ - Route::group(['middleware' => ['admin']], function () { - Route::get('/api/admin/event/participants/{participant}/signIn', 'Adminapi\Events\ParticipantsController@signIn'); - Route::get('/api/admin/event/participants/{participant}', 'Adminapi\Events\ParticipantsController@getParticipant'); - Route::get('/api/admin/event/participants/', 'Adminapi\Events\ParticipantsController@getParticipants'); - Route::get('/api/admin/purchases/{purchase}/setSuccess', 'Adminapi\PurchaseController@setSuccess'); - }); + /** + * API + */ + Route::group(['middleware' => ['api', 'nodebugbar']], function () { + Route::get('/api/events/', 'Api\Events\EventsController@index'); + Route::get('/api/events/upcoming', 'Api\Events\EventsController@showUpcoming'); + Route::get('/api/events/{event}', 'Api\Events\EventsController@show'); + Route::get('/api/events/{event}/participants', 'Api\Events\ParticipantsController@index'); + Route::get('/api/events/{event}/timetables', 'Api\Events\TimetablesController@index'); + Route::get('/api/events/{event}/timetables/{timetable}', 'Api\Events\TimetablesController@show'); + Route::get('/api/events/{event}/tickets', 'Api\Events\TicketsController@index'); + Route::get('/api/events/{event}/tickets/{ticket}', 'Api\Events\TicketsController@show'); + + Route::group(['middleware' => ['auth:sanctum']], function () { + /** + * User API + */ + Route::get('/api/user/me', 'Userapi\MeController@getMe'); + Route::get('/api/user/event/participants', 'Userapi\Events\ParticipantsController@getParticipants'); + + /** + * Gameserver API + */ + Route::group(['middleware' => ['gameserver']], function () { + Route::post('/api/matchmaking/{match}/demo/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchDemo'); + Route::post('/api/matchmaking/{match}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFreeServer'); + Route::post('/api/matchmaking/{match}/finalize/', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalize'); + Route::post('/api/matchmaking/{match}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchFinalizeMap'); + Route::post('/api/matchmaking/{match}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchGolive'); + Route::post('/api/matchmaking/{match}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateround'); + Route::post('/api/matchmaking/{match}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchUpdateplayer'); + Route::get('/api/matchmaking/{match}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@matchMakingMatchConfig'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/demo/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchDemo'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/freeserver/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFreeServer'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalize'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/finalize/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchFinalizeMap'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/golive/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchGolive'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateround/{mapnumber}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateround'); + Route::post('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/updateplayer/{mapnumber}/{player}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchUpdateplayer'); + Route::get('/api/events/{event}/tournaments/{tournament}/{challongeMatchId}/configure/{nummaps}', 'Api\GameMatchApi\GameMatchApiController@tournamentMatchConfig'); }); - }); - - - - /** - * Front End - */ - - - Route::group(['middleware' => ['web']], function () { /** - * Login & Register + * Admin API */ - Route::get('/register/email/verify', 'Auth\VerificationController@show')->name('verification.notice'); - Route::get('/register/email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); - Route::get('/register/email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); - - Route::get('/register/{method}', 'Auth\AuthController@showRegister'); - Route::post('/register/{method}', 'Auth\AuthController@register'); - - Route::get('/login', 'Auth\AuthController@prompt'); - - Route::get('/login/forgot', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); - Route::post('/login/forgot', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); - - Route::post('/login/reset/password', 'Auth\ResetPasswordController@reset')->name('password.update'); - Route::get('/login/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); + Route::group(['middleware' => ['admin']], function () { + Route::get('/api/admin/event/participants/{participant}/signIn', 'Adminapi\Events\ParticipantsController@signIn'); + Route::get('/api/admin/event/participants/{participant}', 'Adminapi\Events\ParticipantsController@getParticipant'); + Route::get('/api/admin/event/participants/', 'Adminapi\Events\ParticipantsController@getParticipants'); + Route::get('/api/admin/purchases/{purchase}/setSuccess', 'Adminapi\PurchaseController@setSuccess'); + }); + }); + }); - Route::get('/login/steam', 'Auth\SteamController@login'); - Route::post('/login/standard', 'Auth\LoginController@login')->name('login.standard');; - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/account', 'AccountController@index'); - Route::get('/account/sso/remove/{method}', 'AccountController@showRemoveSso'); - Route::post('/account/sso/remove/{method}', 'AccountController@removeSso'); - Route::get('/account/sso/add/{method}', 'AccountController@addSso'); - Route::get('/account/tokens/wizzard/start/{application?}/{callbackurl?}', 'AccountController@showTokenWizzardStart'); - Route::post('/account/tokens/wizzard/finish', 'AccountController@showTokenWizzardFinish'); - Route::post('/account/tokens/add', 'AccountController@addToken'); - Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); - Route::post('/account', 'AccountController@update'); - Route::post('/account/delete', 'Auth\SteamController@destroy'); - }); + /** + * Front End + */ - Route::group(['middleware' => ['auth', 'banned']], function () { - Route::get('/account/email', 'AccountController@showMail'); - Route::post('/account/email', 'AccountController@updateMail'); - }); + Route::group(['middleware' => ['web']], function () { - Route::group(['middleware' => ['auth']], function () { - Route::get('/logout', 'Auth\AuthController@logout'); - }); + /** + * Login & Register + */ + Route::get('/register/email/verify', 'Auth\VerificationController@show')->name('verification.notice'); + Route::get('/register/email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify'); + Route::get('/register/email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); + + Route::get('/register/{method}', 'Auth\AuthController@showRegister'); + Route::post('/register/{method}', 'Auth\AuthController@register'); + + Route::get('/login', 'Auth\AuthController@prompt'); + + Route::get('/login/forgot', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); + Route::post('/login/forgot', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); + + Route::post('/login/reset/password', 'Auth\ResetPasswordController@reset')->name('password.update'); + Route::get('/login/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); + + Route::get('/login/steam', 'Auth\SteamController@login'); + + Route::post('/login/standard', 'Auth\LoginController@login')->name('login.standard');; + + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/account', 'AccountController@index'); + Route::get('/account/sso/remove/{method}', 'AccountController@showRemoveSso'); + Route::post('/account/sso/remove/{method}', 'AccountController@removeSso'); + Route::get('/account/sso/add/{method}', 'AccountController@addSso'); + Route::get('/account/tokens/wizzard/start/{application?}/{callbackurl?}', 'AccountController@showTokenWizzardStart'); + Route::post('/account/tokens/wizzard/finish', 'AccountController@showTokenWizzardFinish'); + Route::post('/account/tokens/add', 'AccountController@addToken'); + Route::delete('/account/tokens/remove/{token}', 'AccountController@removeToken'); + Route::post('/account', 'AccountController@update'); + Route::post('/account/delete', 'Auth\SteamController@destroy'); + Route::post('/account/avatar/selected', 'AccountController@update_selected_avatar'); + Route::post('/account/avatar', 'AccountController@update_local_avatar'); + }); - /** - * Index Page - */ - Route::get('/', 'HomeController@index'); + Route::group(['middleware' => ['auth', 'banned']], function () { + Route::get('/account/email', 'AccountController@showMail'); + Route::post('/account/email', 'AccountController@updateMail'); + }); - /** - * News Pages - */ - Route::get('/news', 'NewsController@index'); - Route::get('/news/{newsArticle}', 'NewsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/news/{newsArticle}/comments', 'NewsController@storeComment'); - Route::post('/news/{newsArticle}/comments/{newsComment}', 'NewsController@editComment'); - Route::get('/news/{newsArticle}/comments/{newsComment}/report', 'NewsController@reportComment'); - Route::get('/news/{newsArticle}/comments/{newsComment}/delete', 'NewsController@destroyComment'); - }); - Route::get('/news/tags/{newsTag}', 'NewsController@showTag'); - /** - * Events - */ - Route::get('/events', 'Events\EventsController@index'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function() { - Route::get('/events/participants/{participant}/{fileType}', 'Events\ParticipantsController@exportParticipantAsFile'); - }); - Route::get('/events/{event}', 'Events\EventsController@show'); - Route::get('/events/{event}/big', 'HomeController@bigScreen'); + Route::group(['middleware' => ['auth']], function () { + Route::get('/logout', 'Auth\AuthController@logout'); + }); - /** - * Misc Pages - */ - Route::get('/about', 'HomeController@about'); - Route::get('/contact', 'HomeController@contact'); - Route::get('/terms', 'HomeController@terms'); - Route::get('/legalnotice', 'HomeController@legalNotice'); + /** + * Index Page + */ + Route::get('/', 'HomeController@index'); + /** + * News Pages + */ + Route::get('/news', 'NewsController@index'); + Route::get('/news/{newsArticle}', 'NewsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/news/{newsArticle}/comments', 'NewsController@storeComment'); + Route::post('/news/{newsArticle}/comments/{newsComment}', 'NewsController@editComment'); + Route::get('/news/{newsArticle}/comments/{newsComment}/report', 'NewsController@reportComment'); + Route::get('/news/{newsArticle}/comments/{newsComment}/delete', 'NewsController@destroyComment'); + }); + Route::get('/news/tags/{newsTag}', 'NewsController@showTag'); - /** - * Tickets - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/tickets/retrieve/{participant}', 'Events\TicketsController@retrieve'); - Route::post('/tickets/purchase/{ticket}', 'Events\TicketsController@purchase'); - }); + /** + * Events + */ + Route::get('/events', 'Events\EventsController@index'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/events/participants/{participant}/{fileType}', 'Events\ParticipantsController@exportParticipantAsFile'); + }); + Route::get('/events/{event}', 'Events\EventsController@show'); + Route::get('/events/{event}/big', 'HomeController@bigScreen'); + Route::get('/events/{event}/generate-ics', 'Events\EventsController@generateICS')->name('generate-event-ics'); - /** - * Gifts - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/gift/accept', 'Events\ParticipantsController@acceptGift'); - Route::post('/gift/{participant}', 'Events\ParticipantsController@gift'); - Route::post('/gift/{participant}/revoke', 'Events\ParticipantsController@revokeGift'); - }); + /** + * Misc Pages + */ + Route::get('/about', 'HomeController@about'); + Route::get('/contact', 'HomeController@contact'); + Route::get('/terms', 'HomeController@terms'); + Route::get('/legalnotice', 'HomeController@legalNotice'); - /** - * Galleries - */ - Route::get('/gallery', 'GalleryController@index'); - Route::get('/gallery/{album}', 'GalleryController@show'); - /** - * Help - */ - Route::get('/help', 'HelpController@index'); + /** + * Tickets + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/tickets/retrieve/{participant}', 'Events\TicketsController@retrieve'); + Route::post('/tickets/purchase/{ticket}', 'Events\TicketsController@purchase'); + }); - /** - * Tournaments - */ - Route::get('/events/{event}/tournaments', 'Events\TournamentsController@index'); - Route::get('/events/{event}/tournaments/{tournament}', 'Events\TournamentsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/events/{event}/tournaments/{tournament}/register', 'Events\TournamentsController@registerSingle'); - Route::post('/events/{event}/tournaments/{tournament}/register/team', 'Events\TournamentsController@registerTeam'); - Route::post('/events/{event}/tournaments/{tournament}/register/pug', 'Events\TournamentsController@registerPug'); - Route::post('/events/{event}/tournaments/{tournament}/register/remove', 'Events\TournamentsController@unregister'); - }); + /** + * Gifts + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/gift/accept', 'Events\ParticipantsController@acceptGift'); + Route::post('/gift/{participant}', 'Events\ParticipantsController@gift'); + Route::post('/gift/{participant}/revoke', 'Events\ParticipantsController@revokeGift'); + }); - /** - * GameServers - */ - Route::get('/games/{game}/gameservers/{gameServer}/status', 'GameServersController@status'); + /** + * Galleries + */ + Route::get('/gallery', 'GalleryController@index'); + Route::get('/gallery/{album}', 'GalleryController@show'); + /** + * Help + */ + Route::get('/help', 'HelpController@index'); - /** - * MatchMaking - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/matchmaking', 'MatchMakingController@index'); - Route::get('/matchmaking/invite', 'MatchMakingController@showInvite'); - Route::get('/matchmaking/{match}', 'MatchMakingController@show'); - Route::post('/matchmaking', 'MatchMakingController@store'); - Route::post('/matchmaking/{match}/team/{team}/teamplayer/add', 'MatchMakingController@addusertomatch'); - Route::delete('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'MatchMakingController@deleteuserfrommatch'); - Route::post('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/change', 'MatchMakingController@changeuserteam'); - Route::post('/matchmaking/{match}/team/add', 'MatchMakingController@addteam'); - Route::post('/matchmaking/{match}/team/{team}/update', 'MatchMakingController@updateteam'); - Route::delete('/matchmaking/{match}/team/{team}/delete', 'MatchMakingController@deleteteam'); - Route::post('/matchmaking/{match}/update', 'MatchMakingController@update'); - Route::post('/matchmaking/{match}/start', 'MatchMakingController@start'); - Route::post('/matchmaking/{match}/open', 'MatchMakingController@open'); - Route::post('/matchmaking/{match}/scramble', 'MatchMakingController@scramble'); - Route::post('/matchmaking/{match}/finalize', 'MatchMakingController@finalize'); - Route::delete('/matchmaking/{match}', 'MatchMakingController@destroy'); - }); + /** + * Tournaments + */ + Route::get('/events/{event}/tournaments', 'Events\TournamentsController@index'); + Route::get('/events/{event}/tournaments/{tournament}', 'Events\TournamentsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/events/{event}/tournaments/{tournament}/register', 'Events\TournamentsController@registerSingle'); + Route::post('/events/{event}/tournaments/{tournament}/register/team', 'Events\TournamentsController@registerTeam'); + Route::post('/events/{event}/tournaments/{tournament}/register/pug', 'Events\TournamentsController@registerPug'); + Route::post('/events/{event}/tournaments/{tournament}/register/remove', 'Events\TournamentsController@unregister'); + }); - /** - * Payments - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/payment/checkout', 'PaymentsController@showCheckout'); - Route::get('/payment/review/{paymentGateway}', 'PaymentsController@showReview'); - Route::get('/payment/details/{paymentGateway}', 'PaymentsController@showDetails'); - Route::post('/payment/delivery', 'PaymentsController@delivery'); - Route::get('/payment/delivery/{paymentGateway}', 'PaymentsController@showDelivery'); - Route::get('/payment/callback', 'PaymentsController@process'); - Route::post('/payment/post', 'PaymentsController@post'); - Route::get('/payment/failed', 'PaymentsController@showFailed'); - Route::get('/payment/cancelled', 'PaymentsController@showCancelled'); - Route::get('/payment/successful/{purchase}', 'PaymentsController@showSuccessful'); - Route::get('/payment/pending/{purchase}', 'PaymentsController@showPending'); - }); + /** + * GameServers + */ + Route::get('/games/{game}/gameservers/{gameServer}/status', 'GameServersController@status'); - /** - * Seating - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::post('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@store'); - Route::delete('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@destroy'); - }); - /** - * Search - */ - Route::get('/search/users/autocomplete', 'SearchController@usersAutocomplete')->name('autocomplete'); + /** + * MatchMaking + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/matchmaking', 'MatchMakingController@index'); + Route::get('/matchmaking/invite', 'MatchMakingController@showInvite'); + Route::get('/matchmaking/{match}', 'MatchMakingController@show'); + Route::post('/matchmaking', 'MatchMakingController@store'); + Route::post('/matchmaking/{match}/team/{team}/teamplayer/add', 'MatchMakingController@addusertomatch'); + Route::delete('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'MatchMakingController@deleteuserfrommatch'); + Route::post('/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/change', 'MatchMakingController@changeuserteam'); + Route::post('/matchmaking/{match}/team/add', 'MatchMakingController@addteam'); + Route::post('/matchmaking/{match}/team/{team}/update', 'MatchMakingController@updateteam'); + Route::delete('/matchmaking/{match}/team/{team}/delete', 'MatchMakingController@deleteteam'); + Route::post('/matchmaking/{match}/update', 'MatchMakingController@update'); + Route::post('/matchmaking/{match}/start', 'MatchMakingController@start'); + Route::post('/matchmaking/{match}/open', 'MatchMakingController@open'); + Route::post('/matchmaking/{match}/scramble', 'MatchMakingController@scramble'); + Route::post('/matchmaking/{match}/finalize', 'MatchMakingController@finalize'); + Route::delete('/matchmaking/{match}', 'MatchMakingController@destroy'); + }); - /** - * Polls - */ - Route::get('/polls', 'PollsController@index'); - Route::get('/polls/{poll}', 'PollsController@show'); - Route::group(['middleware' => ['auth', 'banned', 'verified']], function () { - Route::post('/polls/{poll}/options', 'PollsController@storeOption'); - Route::get('/polls/{poll}/options/{option}/vote', 'PollsController@vote'); - Route::get('/polls/{poll}/options/{option}/abstain', 'PollsController@abstain'); - }); + /** + * Payments + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/payment/checkout', 'PaymentsController@showCheckout'); + Route::get('/payment/review/{paymentGateway}', 'PaymentsController@showReview'); + Route::get('/payment/details/{paymentGateway}', 'PaymentsController@showDetails'); + Route::post('/payment/delivery', 'PaymentsController@delivery'); + Route::get('/payment/delivery/{paymentGateway}', 'PaymentsController@showDelivery'); + Route::get('/payment/callback', 'PaymentsController@process'); + Route::post('/payment/post', 'PaymentsController@post'); + Route::get('/payment/failed', 'PaymentsController@showFailed'); + Route::get('/payment/cancelled', 'PaymentsController@showCancelled'); + Route::get('/payment/successful/{purchase}', 'PaymentsController@showSuccessful'); + Route::get('/payment/pending/{purchase}', 'PaymentsController@showPending'); + }); - /** - * Shop - */ - Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { - Route::get('/shop/orders', 'ShopController@showAllOrders'); - Route::get('/shop/orders/{order}', 'ShopController@showOrder'); - }); - Route::get('/shop', 'ShopController@index'); - Route::get('/shop/basket', 'ShopController@showBasket'); - Route::post('/shop/basket', 'ShopController@updateBasket'); - Route::get('/shop/{category}', 'ShopController@showCategory'); - Route::get('/shop/{category}/{item}', 'ShopController@showItem'); + /** + * Seating + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::post('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@store'); + Route::delete('/events/{event}/seating/{seatingPlan}', 'Events\SeatingController@destroy'); }); /** - * Admin + * Search */ - Route::group(['middleware' => ['web', 'admin']], function () { + Route::get('/search/users/autocomplete', 'SearchController@usersAutocomplete')->name('autocomplete'); - /** - * Index Page - */ - Route::get('/admin', 'Admin\AdminController@index'); + /** + * Polls + */ + Route::get('/polls', 'PollsController@index'); + Route::get('/polls/{poll}', 'PollsController@show'); + Route::group(['middleware' => ['auth', 'banned', 'verified']], function () { + Route::post('/polls/{poll}/options', 'PollsController@storeOption'); + Route::get('/polls/{poll}/options/{option}/vote', 'PollsController@vote'); + Route::get('/polls/{poll}/options/{option}/abstain', 'PollsController@abstain'); + }); - /** - * Events - */ - Route::get('/admin/events', 'Admin\Events\EventsController@index'); - Route::post('/admin/events', 'Admin\Events\EventsController@store'); - Route::get('/admin/events/{event}', 'Admin\Events\EventsController@show'); - Route::post('/admin/events/{event}', 'Admin\Events\EventsController@update'); - Route::delete('/admin/events/{event}', 'Admin\Events\EventsController@destroy'); - Route::post('/admin/events/{event}/information', 'Admin\Events\InformationController@store'); - Route::post('/admin/information/{information}', 'Admin\Events\InformationController@update'); - Route::delete('/admin/information/{information}', 'Admin\Events\InformationController@destroy'); - /** - * Seating - */ - Route::get('/admin/events/{event}/seating', 'Admin\Events\SeatingController@index'); - Route::post('/admin/events/{event}/seating', 'Admin\Events\SeatingController@store'); - Route::get('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@show'); - Route::post('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@update'); - Route::delete('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@destroy'); - Route::post('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@storeSeat'); - Route::delete('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@destroySeat'); + /** + * Shop + */ + Route::group(['middleware' => ['auth', 'banned', 'verified', 'nophonenumber']], function () { + Route::get('/shop/orders', 'ShopController@showAllOrders'); + Route::get('/shop/orders/{order}', 'ShopController@showOrder'); + }); + Route::get('/shop', 'ShopController@index'); + Route::get('/shop/basket', 'ShopController@showBasket'); + Route::post('/shop/basket', 'ShopController@updateBasket'); + Route::get('/shop/{category}', 'ShopController@showCategory'); + Route::get('/shop/{category}/{item}', 'ShopController@showItem'); + }); - /** - * Timetables - */ - Route::get('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@index'); - Route::post('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@store'); - Route::get('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@show'); - Route::post('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@update'); - Route::delete('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@destroy'); - Route::post('/admin/events/{event}/timetables/{timetable}/data', 'Admin\Events\TimetableDataController@store'); - Route::post( - '/admin/events/{event}/timetables/{timetable}/data/{data}', - 'Admin\Events\TimetableDataController@update' - ); - Route::delete('/admin/events/{event}/timetables/{timetable}/data/{data}', 'Admin\Events\TimetableDataController@destroy'); + /** + * Admin + */ + Route::group(['middleware' => ['web', 'admin']], function () { + /** + * Index Page + */ + Route::get('/admin', 'Admin\AdminController@index'); - /** - * Tournaments - */ - Route::get('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@index'); - Route::post('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@store'); - Route::get('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@show'); - Route::post('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@update'); - Route::delete('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@destroy'); - Route::post('/admin/events/{event}/tournaments/{tournament}/start', 'Admin\Events\TournamentsController@start'); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/finalize', - 'Admin\Events\TournamentsController@finalize' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/enableliveediting', - 'Admin\Events\TournamentsController@enableliveediting' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/disableliveediting', - 'Admin\Events\TournamentsController@disableliveediting' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/addteam', - 'Admin\Events\TournamentsController@addTeam' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match', - 'Admin\Events\TournamentsController@updateMatch' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}', - 'Admin\Events\TournamentsMatchServerController@store' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/update', - 'Admin\Events\TournamentsMatchServerController@update' - ); - Route::delete( - '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/delete', - 'Admin\Events\TournamentsMatchServerController@destroy' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/team', - 'Admin\Events\TournamentsController@updateParticipantTeam' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/remove', - 'Admin\Events\TournamentsController@unregisterParticipant' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addpug', - 'Admin\Events\TournamentsController@addPug' - ); - Route::post( - '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addsingle', - 'Admin\Events\TournamentsController@addSingle' - ); + /** + * Events + */ + Route::get('/admin/events', 'Admin\Events\EventsController@index'); + Route::post('/admin/events', 'Admin\Events\EventsController@store'); + Route::get('/admin/events/{event}', 'Admin\Events\EventsController@show'); + Route::post('/admin/events/{event}', 'Admin\Events\EventsController@update'); + Route::delete('/admin/events/{event}', 'Admin\Events\EventsController@destroy'); + Route::post('/admin/events/{event}/information', 'Admin\Events\InformationController@store'); + Route::post('/admin/information/{information}', 'Admin\Events\InformationController@update'); + Route::delete('/admin/information/{information}', 'Admin\Events\InformationController@destroy'); + /** + * Seating + */ + Route::get('/admin/events/{event}/seating', 'Admin\Events\SeatingController@index'); + Route::post('/admin/events/{event}/seating', 'Admin\Events\SeatingController@store'); + Route::get('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@show'); + Route::post('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@update'); + Route::delete('/admin/events/{event}/seating/{seatingPlan}', 'Admin\Events\SeatingController@destroy'); + Route::post('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@storeSeat'); + Route::delete('/admin/events/{event}/seating/{seatingPlan}/seat', 'Admin\Events\SeatingController@destroySeat'); + /** + * Timetables + */ + Route::get('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@index'); + Route::post('/admin/events/{event}/timetables', 'Admin\Events\TimetablesController@store'); + Route::get('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@show'); + Route::post('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@update'); + Route::delete('/admin/events/{event}/timetables/{timetable}', 'Admin\Events\TimetablesController@destroy'); + Route::post('/admin/events/{event}/timetables/{timetable}/data', 'Admin\Events\TimetableDataController@store'); + Route::post( + '/admin/events/{event}/timetables/{timetable}/data/{data}', + 'Admin\Events\TimetableDataController@update' + ); + Route::delete('/admin/events/{event}/timetables/{timetable}/data/{data}', 'Admin\Events\TimetableDataController@destroy'); - // TODO - REMOVE THIS AND ALL LIKE IT - /** - * Legacy - */ - Route::get('/admin/events/tournaments/fix', 'Admin\Events\TournamentsController@fixScores'); + /** + * Tournaments + */ + Route::get('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@index'); + Route::post('/admin/events/{event}/tournaments', 'Admin\Events\TournamentsController@store'); + Route::get('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@show'); + Route::post('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@update'); + Route::delete('/admin/events/{event}/tournaments/{tournament}', 'Admin\Events\TournamentsController@destroy'); + Route::post('/admin/events/{event}/tournaments/{tournament}/start', 'Admin\Events\TournamentsController@start'); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/finalize', + 'Admin\Events\TournamentsController@finalize' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/enableliveediting', + 'Admin\Events\TournamentsController@enableliveediting' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/disableliveediting', + 'Admin\Events\TournamentsController@disableliveediting' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/addteam', + 'Admin\Events\TournamentsController@addTeam' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match', + 'Admin\Events\TournamentsController@updateMatch' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}', + 'Admin\Events\TournamentsMatchServerController@store' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/update', + 'Admin\Events\TournamentsMatchServerController@update' + ); + Route::delete( + '/admin/events/{event}/tournaments/{tournament}/match/{challongeMatchId}/delete', + 'Admin\Events\TournamentsMatchServerController@destroy' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/team', + 'Admin\Events\TournamentsController@updateParticipantTeam' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/remove', + 'Admin\Events\TournamentsController@unregisterParticipant' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addpug', + 'Admin\Events\TournamentsController@addPug' + ); + Route::post( + '/admin/events/{event}/tournaments/{tournament}/participants/{participant}/addsingle', + 'Admin\Events\TournamentsController@addSingle' + ); + + + // TODO - REMOVE THIS AND ALL LIKE IT + /** + * Legacy + */ + Route::get('/admin/events/tournaments/fix', 'Admin\Events\TournamentsController@fixScores'); - /** - * GameTemplates - */ - Route::get('/admin/games/gametemplates', 'Admin\GameTemplatesController@index'); - Route::post('/admin/games/gametemplates', 'Admin\GameTemplatesController@deploy'); - /** - * Games - */ - Route::get('/admin/games', 'Admin\GamesController@index'); - Route::post('/admin/games', 'Admin\GamesController@store'); - Route::get('/admin/games/{game}', 'Admin\GamesController@show'); - Route::post('/admin/games/{game}', 'Admin\GamesController@update'); - Route::delete('/admin/games/{game}', 'Admin\GamesController@destroy'); + /** + * GameTemplates + */ + Route::get('/admin/games/gametemplates', 'Admin\GameTemplatesController@index'); + Route::post('/admin/games/gametemplates', 'Admin\GameTemplatesController@deploy'); - /** - * GameServers - */ - Route::get('/admin/games/{game}/gameservers', 'Admin\GameServersController@index'); - Route::post('/admin/games/{game}/gameservers', 'Admin\GameServersController@store'); - Route::get('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@show'); - Route::post('/admin/games/{game}/gameservers/{gameServer}/updatetoken', 'Admin\GameServersController@updatetoken'); - Route::post('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@update'); - Route::delete('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@destroy'); + /** + * Games + */ + Route::get('/admin/games', 'Admin\GamesController@index'); + Route::post('/admin/games', 'Admin\GamesController@store'); + Route::get('/admin/games/{game}', 'Admin\GamesController@show'); + Route::post('/admin/games/{game}', 'Admin\GamesController@update'); + Route::delete('/admin/games/{game}', 'Admin\GamesController@destroy'); - /** - * GameServerCommands - */ - Route::get('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@index'); - Route::post('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@store'); - Route::get('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@show'); - Route::post('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@update'); - Route::delete('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@destroy'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}', 'Admin\GameServerCommandsController@executeGameServerCommand'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/tournament/{tournament}', 'Admin\GameServerCommandsController@executeGameServerTournamentMatchCommand'); - Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/matchmaking/{match}', 'Admin\GameServerCommandsController@executeGameServerMatchMakingCommand'); + /** + * GameServers + */ + Route::get('/admin/games/{game}/gameservers', 'Admin\GameServersController@index'); + Route::post('/admin/games/{game}/gameservers', 'Admin\GameServersController@store'); + Route::get('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@show'); + Route::post('/admin/games/{game}/gameservers/{gameServer}/updatetoken', 'Admin\GameServersController@updatetoken'); + Route::post('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@update'); + Route::delete('/admin/games/{game}/gameservers/{gameServer}', 'Admin\GameServersController@destroy'); - /** - * GameServerCommandParametrs - */ - Route::post('/admin/games/{game}/gameservercommandparameters', 'Admin\GameServerCommandParametersController@store'); - Route::post('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@update'); - Route::delete('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@destroy'); + /** + * GameServerCommands + */ + Route::get('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@index'); + Route::post('/admin/games/{game}/gameservercommands', 'Admin\GameServerCommandsController@store'); + Route::get('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@show'); + Route::post('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@update'); + Route::delete('/admin/games/{game}/gameservercommands/{gameServerCommand}', 'Admin\GameServerCommandsController@destroy'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}', 'Admin\GameServerCommandsController@executeGameServerCommand'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/tournament/{tournament}', 'Admin\GameServerCommandsController@executeGameServerTournamentMatchCommand'); + Route::post('/admin/games/{game}/gameservercommands/execute/{gameServer}/matchmaking/{match}', 'Admin\GameServerCommandsController@executeGameServerMatchMakingCommand'); + /** + * GameServerCommandParametrs + */ + Route::post('/admin/games/{game}/gameservercommandparameters', 'Admin\GameServerCommandParametersController@store'); + Route::post('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@update'); + Route::delete('/admin/games/{game}/gameservercommandparameters/{gameServerCommandParameter}', 'Admin\GameServerCommandParametersController@destroy'); - /** - * MatchReplays - */ - Route::delete('/admin/replays/{matchReplay}', 'Admin\MatchReplayController@destroy'); + /** + * MatchReplays + */ + Route::delete('/admin/replays/{matchReplay}', 'Admin\MatchReplayController@destroy'); - /** - * Participants - */ - Route::get('/admin/events/{event}/participants', 'Admin\Events\ParticipantsController@index'); - Route::get('/admin/events/{event}/participants/signoutall', 'Admin\Events\ParticipantsController@signoutall'); - Route::get('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@show'); - Route::post('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@update'); - Route::post( - '/admin/events/{event}/participants/{participant}/signin', - 'Admin\Events\ParticipantsController@signIn' - ); - Route::post( - '/admin/events/{event}/participants/{participant}/transfer', - 'Admin\Events\ParticipantsController@transfer' - ); - Route::post( - '/admin/events/{event}/participants/{participant}/revoke', - 'Admin\Events\ParticipantsController@revoke' - ); - if (config('admin.super_danger_zone')) { - Route::delete( - '/admin/events/{event}/participants/{participant}', - 'Admin\Events\ParticipantsController@delete' - ); - } - /** - * Announcements - */ - Route::post('/admin/events/{event}/announcements', 'Admin\Events\AnnouncementsController@store'); - Route::post( - '/admin/events/{event}/announcements/{announcement}', - 'Admin\Events\AnnouncementsController@update' - ); + /** + * Participants + */ + Route::get('/admin/events/{event}/participants', 'Admin\Events\ParticipantsController@index'); + Route::get('/admin/events/{event}/participants/signoutall', 'Admin\Events\ParticipantsController@signoutall'); + Route::get('/admin/events/{event}/participants/{participant}/signout', 'Admin\Events\ParticipantsController@signout'); + Route::get('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@show'); + Route::post('/admin/events/{event}/participants/{participant}', 'Admin\Events\ParticipantsController@update'); + Route::post( + '/admin/events/{event}/participants/{participant}/signin', + 'Admin\Events\ParticipantsController@signIn' + ); + Route::post( + '/admin/events/{event}/participants/{participant}/transfer', + 'Admin\Events\ParticipantsController@transfer' + ); + Route::post( + '/admin/events/{event}/participants/{participant}/revoke', + 'Admin\Events\ParticipantsController@revoke' + ); + if (config('admin.super_danger_zone')) { Route::delete( - '/admin/events/{event}/announcements/{announcement}', - 'Admin\Events\AnnouncementsController@destroy' + '/admin/events/{event}/participants/{participant}', + 'Admin\Events\ParticipantsController@delete' ); + } - /** - * Mailing - */ - Route::get('/admin/mailing', 'Admin\MailingController@index'); - Route::get('/admin/mailing/{mailTemplate}', 'Admin\MailingController@show'); - Route::post('/admin/mailing', 'Admin\MailingController@store'); - Route::post('/admin/mailing/{mailTemplate}/send', 'Admin\MailingController@send'); - Route::post('/admin/mailing/{mailTemplate}', 'Admin\MailingController@update'); - Route::delete('/admin/mailing/{mailTemplate}', 'Admin\MailingController@destroy'); + /** + * Announcements + */ + Route::post('/admin/events/{event}/announcements', 'Admin\Events\AnnouncementsController@store'); + Route::post( + '/admin/events/{event}/announcements/{announcement}', + 'Admin\Events\AnnouncementsController@update' + ); + Route::delete( + '/admin/events/{event}/announcements/{announcement}', + 'Admin\Events\AnnouncementsController@destroy' + ); + /** + * Mailing + */ + Route::get('/admin/mailing', 'Admin\MailingController@index'); + Route::get('/admin/mailing/{mailTemplate}', 'Admin\MailingController@show'); + Route::post('/admin/mailing', 'Admin\MailingController@store'); + Route::post('/admin/mailing/{mailTemplate}/send', 'Admin\MailingController@send'); + Route::post('/admin/mailing/{mailTemplate}', 'Admin\MailingController@update'); + Route::delete('/admin/mailing/{mailTemplate}', 'Admin\MailingController@destroy'); - /** - * Tickets - */ - Route::get('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@index'); - Route::post('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@store'); - Route::get('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@show'); - Route::post('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@update'); - Route::delete('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@destroy'); - /** - * Gifts - */ - Route::post('/admin/events/{event}/freebies/admin', 'Admin\Events\EventsController@freeStaff'); - Route::post('/admin/events/{event}/freebies/gift', 'Admin\Events\EventsController@freeGift'); + /** + * Tickets + */ + Route::get('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@index'); + Route::post('/admin/events/{event}/tickets', 'Admin\Events\TicketsController@store'); + Route::get('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@show'); + Route::post('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@update'); + Route::delete('/admin/events/{event}/tickets/{ticket}', 'Admin\Events\TicketsController@destroy'); - /** - * Sponsors - */ - Route::post('/admin/events/{event}/sponsors', 'Admin\Events\SponsorsController@store'); - Route::post('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@update'); - Route::delete('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@destroy'); + /** + * Gifts + */ + Route::post('/admin/events/{event}/freebies/staff', 'Admin\Events\EventsController@freeStaff'); + Route::post('/admin/events/{event}/freebies/gift', 'Admin\Events\EventsController@freeGift'); - /** - * Venues - */ - Route::get('/admin/venues', 'Admin\Events\VenuesController@index'); - Route::post('/admin/venues', 'Admin\Events\VenuesController@store'); - Route::get('/admin/venues/{venue}', 'Admin\Events\VenuesController@show'); - Route::post('/admin/venues/{venue}', 'Admin\Events\VenuesController@update'); - Route::delete('/admin/venues/{venue}', 'Admin\Events\VenuesController@destroy'); - Route::post('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@updateImage'); - Route::delete('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@destroyImage'); + /** + * Sponsors + */ + Route::post('/admin/events/{event}/sponsors', 'Admin\Events\SponsorsController@store'); + Route::post('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@update'); + Route::delete('/admin/events/{event}/sponsors/{sponsor}', 'Admin\Events\SponsorsController@destroy'); - /** - * Galleries - */ - Route::get('/admin/gallery', 'Admin\GalleryController@index'); - Route::post('/admin/gallery', 'Admin\GalleryController@store'); - Route::get('/admin/gallery/{album}', 'Admin\GalleryController@show'); - Route::post('/admin/gallery/{album}', 'Admin\GalleryController@update'); - Route::delete('/admin/gallery/{album}', 'Admin\GalleryController@destroy'); - Route::post('/admin/gallery/{album}/upload', 'Admin\GalleryController@uploadFile'); - Route::post('/admin/gallery/{album}/{image}', 'Admin\GalleryController@updateFile'); - Route::delete('/admin/gallery/{album}/{image}', 'Admin\GalleryController@destroyFile'); + /** + * Venues + */ + Route::get('/admin/venues', 'Admin\Events\VenuesController@index'); + Route::post('/admin/venues', 'Admin\Events\VenuesController@store'); + Route::get('/admin/venues/{venue}', 'Admin\Events\VenuesController@show'); + Route::post('/admin/venues/{venue}', 'Admin\Events\VenuesController@update'); + Route::delete('/admin/venues/{venue}', 'Admin\Events\VenuesController@destroy'); + Route::post('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@updateImage'); + Route::delete('/admin/venues/{venue}/{image}', 'Admin\Events\VenuesController@destroyImage'); - /** - * Help - */ - Route::get('/admin/help', 'Admin\HelpController@index'); - Route::post('/admin/help', 'Admin\HelpController@store'); - Route::get('/admin/help/{helpCategory}', 'Admin\HelpController@show'); - Route::post('/admin/help/{helpCategory}', 'Admin\HelpController@update'); - Route::delete('/admin/help/{helpCategory}', 'Admin\HelpController@destroy'); - Route::post('/admin/help/{helpCategory}/{entry}/upload', 'Admin\HelpController@uploadFiles'); - Route::post('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@updateFile'); - Route::delete('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@destroyFile'); - Route::post('/admin/help/{helpCategory}/add', 'Admin\HelpController@addHelpEntry'); - Route::post('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@updateHelpEntry'); - Route::delete('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@destroyHelpEntry'); + /** + * Galleries + */ + Route::get('/admin/gallery', 'Admin\GalleryController@index'); + Route::post('/admin/gallery', 'Admin\GalleryController@store'); + Route::get('/admin/gallery/{album}', 'Admin\GalleryController@show'); + Route::post('/admin/gallery/{album}', 'Admin\GalleryController@update'); + Route::delete('/admin/gallery/{album}', 'Admin\GalleryController@destroy'); + Route::post('/admin/gallery/{album}/upload', 'Admin\GalleryController@uploadFile'); + Route::post('/admin/gallery/{album}/{image}', 'Admin\GalleryController@updateFile'); + Route::delete('/admin/gallery/{album}/{image}', 'Admin\GalleryController@destroyFile'); - /** - * Users - */ - Route::get('/admin/users', 'Admin\UsersController@index'); - Route::get('/admin/users/{user}', 'Admin\UsersController@show'); - Route::delete('/admin/users/{user}', 'Admin\UsersController@remove'); - Route::post('/admin/users/{user}/admin', 'Admin\UsersController@grantAdmin'); - Route::delete('/admin/users/{user}/admin', 'Admin\UsersController@removeAdmin'); - Route::post('/admin/users/{user}/ban', 'Admin\UsersController@ban'); - Route::post('/admin/users/{user}/unban', 'Admin\UsersController@unban'); - Route::post('/admin/users/{user}/setemailverification', 'Admin\UsersController@setemailverification'); - Route::post('/admin/users/{user}/removemailverification', 'Admin\UsersController@removemailverification'); - Route::post('/admin/users/{user}/unauthorizeThirdparty/{method}', 'Admin\UsersController@unauthorizeThirdparty'); + /** + * Help + */ + Route::get('/admin/help', 'Admin\HelpController@index'); + Route::post('/admin/help', 'Admin\HelpController@store'); + Route::get('/admin/help/{helpCategory}', 'Admin\HelpController@show'); + Route::post('/admin/help/{helpCategory}', 'Admin\HelpController@update'); + Route::delete('/admin/help/{helpCategory}', 'Admin\HelpController@destroy'); + Route::post('/admin/help/{helpCategory}/{entry}/upload', 'Admin\HelpController@uploadFiles'); + Route::post('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@updateFile'); + Route::delete('/admin/help/{helpCategory}/{entry}/{attachment}', 'Admin\HelpController@destroyFile'); + Route::post('/admin/help/{helpCategory}/add', 'Admin\HelpController@addHelpEntry'); + Route::post('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@updateHelpEntry'); + Route::delete('/admin/help/{helpCategory}/{entry}', 'Admin\HelpController@destroyHelpEntry'); - /** - * MatchMaking - */ - Route::get('/admin/matchmaking', 'Admin\MatchMakingController@index'); - Route::post('/admin/matchmaking/{match}/serverstore', 'Admin\MatchMakingServerController@store'); - Route::post('/admin/matchmaking/{match}/serverupdate', 'Admin\MatchMakingServerController@update'); - Route::delete('/admin/matchmaking/{match}/serverdelete', 'Admin\MatchMakingServerController@destroy'); - Route::get('/admin/matchmaking/{match}', 'Admin\MatchMakingController@show'); - Route::post('/admin/matchmaking', 'Admin\MatchMakingController@store'); - Route::post('/admin/matchmaking/{match}/team/{team}/teamplayer/add', 'Admin\MatchMakingController@addusertomatch'); - Route::delete('/admin/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'Admin\MatchMakingController@deleteuserfrommatch'); - Route::post('/admin/matchmaking/{match}/team/add', 'Admin\MatchMakingController@addteam'); - Route::post('/admin/matchmaking/{match}/team/{team}/update', 'Admin\MatchMakingController@updateteam'); - Route::delete('/admin/matchmaking/{match}/team/{team}/delete', 'Admin\MatchMakingController@deleteteam'); - Route::post('/admin/matchmaking/{match}/update', 'Admin\MatchMakingController@update'); - Route::post('/admin/matchmaking/{match}/start', 'Admin\MatchMakingController@start'); - Route::post('/admin/matchmaking/{match}/open', 'Admin\MatchMakingController@open'); - Route::post('/admin/matchmaking/{match}/finalize', 'Admin\MatchMakingController@finalize'); - Route::delete('/admin/matchmaking/{match}', 'Admin\MatchMakingController@destroy'); + /** + * Users + */ + Route::get('/admin/users', 'Admin\UsersController@index'); + Route::get('/admin/users/{user}', 'Admin\UsersController@show'); + Route::delete('/admin/users/{user}', 'Admin\UsersController@remove'); + Route::post('/admin/users/{user}/admin', 'Admin\UsersController@grantAdmin'); + Route::delete('/admin/users/{user}/admin', 'Admin\UsersController@removeAdmin'); + Route::post('/admin/users/{user}/ban', 'Admin\UsersController@ban'); + Route::post('/admin/users/{user}/unban', 'Admin\UsersController@unban'); + Route::post('/admin/users/{user}/setemailverification', 'Admin\UsersController@setemailverification'); + Route::post('/admin/users/{user}/removemailverification', 'Admin\UsersController@removemailverification'); + Route::post('/admin/users/{user}/unauthorizeThirdparty/{method}', 'Admin\UsersController@unauthorizeThirdparty'); - /** - * Settings - */ - Route::get('/admin/settings', 'Admin\SettingsController@index'); - Route::post('/admin/settings', 'Admin\SettingsController@update'); - Route::get('/admin/settings/org', 'Admin\SettingsController@showOrg'); - Route::get('/admin/settings/payments', 'Admin\SettingsController@showPayments'); - Route::get('/admin/settings/systems', 'Admin\SettingsController@showSystems'); - Route::post('/admin/settings/systems', 'Admin\SettingsController@updateSystems'); - Route::get('/admin/settings/auth', 'Admin\SettingsController@showAuth'); - Route::get('/admin/settings/api', 'Admin\SettingsController@showApi'); - Route::post('/admin/settings/api', 'Admin\SettingsController@updateApi'); - Route::get('/admin/settings/link/{social}', 'Admin\SettingsController@linkSocial'); - Route::delete('/admin/settings/unlink/{social}', 'Admin\SettingsController@unlinkSocial'); - Route::post('/admin/settings/payments/{gateway}/disable', 'Admin\SettingsController@disablePaymentGateway'); - Route::post('/admin/settings/payments/{gateway}/enable', 'Admin\SettingsController@enablePaymentGateway'); - Route::post('/admin/settings/login/{method}/disable', 'Admin\SettingsController@disableLoginMethod'); - Route::post('/admin/settings/login/{method}/enable', 'Admin\SettingsController@enableLoginMethod'); - Route::post('/admin/settings/auth/general', 'Admin\SettingsController@updateAuthGeneral'); - Route::post('/admin/settings/auth/steam', 'Admin\SettingsController@updateAuthSteam'); - Route::post('/admin/settings/credit/enable', 'Admin\SettingsController@enableCreditSystem'); - Route::post('/admin/settings/credit/disable', 'Admin\SettingsController@disableCreditSystem'); - Route::post('/admin/settings/shop/enable', 'Admin\SettingsController@enableShopSystem'); - Route::post('/admin/settings/shop/disable', 'Admin\SettingsController@disableShopSystem'); - Route::post('/admin/settings/gallery/enable', 'Admin\SettingsController@enableGallerySystem'); - Route::post('/admin/settings/gallery/disable', 'Admin\SettingsController@disableGallerySystem'); - Route::post('/admin/settings/help/enable', 'Admin\SettingsController@enableHelpSystem'); - Route::post('/admin/settings/help/disable', 'Admin\SettingsController@disableHelpSystem'); - Route::post('/admin/settings/matchmaking/enable', 'Admin\SettingsController@enableMatchMakingSystem'); - Route::post('/admin/settings/matchmaking/disable', 'Admin\SettingsController@disableMatchMakingSystem'); - Route::post('/admin/settings/generate/qr', 'Admin\SettingsController@regenerateQRCodes'); - Route::post('/admin/settings/generate/newqr', 'Admin\SettingsController@regenerateQRCodesWithNewNames'); + /** + * MatchMaking + */ + Route::get('/admin/matchmaking', 'Admin\MatchMakingController@index'); + Route::post('/admin/matchmaking/{match}/serverstore', 'Admin\MatchMakingServerController@store'); + Route::post('/admin/matchmaking/{match}/serverupdate', 'Admin\MatchMakingServerController@update'); + Route::delete('/admin/matchmaking/{match}/serverdelete', 'Admin\MatchMakingServerController@destroy'); + Route::get('/admin/matchmaking/{match}', 'Admin\MatchMakingController@show'); + Route::post('/admin/matchmaking', 'Admin\MatchMakingController@store'); + Route::post('/admin/matchmaking/{match}/team/{team}/teamplayer/add', 'Admin\MatchMakingController@addusertomatch'); + Route::delete('/admin/matchmaking/{match}/team/{team}/teamplayer/{teamplayer}/delete', 'Admin\MatchMakingController@deleteuserfrommatch'); + Route::post('/admin/matchmaking/{match}/team/add', 'Admin\MatchMakingController@addteam'); + Route::post('/admin/matchmaking/{match}/team/{team}/update', 'Admin\MatchMakingController@updateteam'); + Route::delete('/admin/matchmaking/{match}/team/{team}/delete', 'Admin\MatchMakingController@deleteteam'); + Route::post('/admin/matchmaking/{match}/update', 'Admin\MatchMakingController@update'); + Route::post('/admin/matchmaking/{match}/start', 'Admin\MatchMakingController@start'); + Route::post('/admin/matchmaking/{match}/open', 'Admin\MatchMakingController@open'); + Route::post('/admin/matchmaking/{match}/finalize', 'Admin\MatchMakingController@finalize'); + Route::delete('/admin/matchmaking/{match}', 'Admin\MatchMakingController@destroy'); - /** - * Appearance - */ - Route::get('/admin/settings/appearance', 'Admin\AppearanceController@index'); - Route::post('/admin/settings/appearance/slider/images/', 'Admin\AppearanceController@sliderUpload'); - Route::post('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderUpdate'); - Route::delete('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderDelete'); - Route::get('/admin/settings/appearance/css/recompile', 'Admin\AppearanceController@cssRecompile'); - Route::get('/admin/settings/appearance/css/updatedatabasefromfile', 'Admin\AppearanceController@cssUpdateDatabaseFromFile'); - Route::post('/admin/settings/appearance/css/override', 'Admin\AppearanceController@cssOverride'); - Route::post('/admin/settings/appearance/css/variables', 'Admin\AppearanceController@cssVariables'); + /** + * Settings + */ + Route::get('/admin/settings', 'Admin\SettingsController@index'); + Route::post('/admin/settings', 'Admin\SettingsController@update'); + Route::get('/admin/settings/org', 'Admin\SettingsController@showOrg'); + Route::get('/admin/settings/payments', 'Admin\SettingsController@showPayments'); + Route::get('/admin/settings/systems', 'Admin\SettingsController@showSystems'); + Route::post('/admin/settings/systems', 'Admin\SettingsController@updateSystems'); + Route::get('/admin/settings/auth', 'Admin\SettingsController@showAuth'); + Route::get('/admin/settings/api', 'Admin\SettingsController@showApi'); + Route::post('/admin/settings/api', 'Admin\SettingsController@updateApi'); + Route::get('/admin/settings/link/{social}', 'Admin\SettingsController@linkSocial'); + Route::delete('/admin/settings/unlink/{social}', 'Admin\SettingsController@unlinkSocial'); + Route::post('/admin/settings/payments/{gateway}/disable', 'Admin\SettingsController@disablePaymentGateway'); + Route::post('/admin/settings/payments/{gateway}/enable', 'Admin\SettingsController@enablePaymentGateway'); + Route::post('/admin/settings/login/{method}/disable', 'Admin\SettingsController@disableLoginMethod'); + Route::post('/admin/settings/login/{method}/enable', 'Admin\SettingsController@enableLoginMethod'); + Route::post('/admin/settings/auth/general', 'Admin\SettingsController@updateAuthGeneral'); + Route::post('/admin/settings/auth/steam', 'Admin\SettingsController@updateAuthSteam'); + Route::post('/admin/settings/credit/enable', 'Admin\SettingsController@enableCreditSystem'); + Route::post('/admin/settings/credit/disable', 'Admin\SettingsController@disableCreditSystem'); + Route::post('/admin/settings/shop/enable', 'Admin\SettingsController@enableShopSystem'); + Route::post('/admin/settings/shop/disable', 'Admin\SettingsController@disableShopSystem'); + Route::post('/admin/settings/gallery/enable', 'Admin\SettingsController@enableGallerySystem'); + Route::post('/admin/settings/gallery/disable', 'Admin\SettingsController@disableGallerySystem'); + Route::post('/admin/settings/help/enable', 'Admin\SettingsController@enableHelpSystem'); + Route::post('/admin/settings/help/disable', 'Admin\SettingsController@disableHelpSystem'); + Route::post('/admin/settings/matchmaking/enable', 'Admin\SettingsController@enableMatchMakingSystem'); + Route::post('/admin/settings/matchmaking/disable', 'Admin\SettingsController@disableMatchMakingSystem'); + Route::post('/admin/settings/userlocale/enable', 'Admin\SettingsController@enableUserLocale'); + Route::post('/admin/settings/userlocale/disable', 'Admin\SettingsController@disableUserLocale'); + Route::post('/admin/settings/userlocale/reset', 'Admin\SettingsController@resetUserLocales'); + Route::post('/admin/settings/generate/qr', 'Admin\SettingsController@regenerateQRCodes'); + Route::post('/admin/settings/generate/newqr', 'Admin\SettingsController@regenerateQRCodesWithNewNames'); - /** - * News - */ - Route::get('/admin/news', 'Admin\NewsController@index'); - Route::post('/admin/news', 'Admin\NewsController@store'); - Route::get('/admin/news/{newsArticle}', 'Admin\NewsController@show'); - Route::post('/admin/news/{newsArticle}', 'Admin\NewsController@update'); - Route::delete('/admin/news/{newsArticle}', 'Admin\NewsController@destroy'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/delete', 'Admin\NewsController@destroyComment'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/approve', 'Admin\NewsController@approveComment'); - Route::get('/admin/news/{newsArticle}/comments/{newsComment}/reject', 'Admin\NewsController@rejectComment'); - Route::get( - '/admin/news/{newsArticle}/comments/{newsComment}/reports/{newsCommentReport}/delete', - 'Admin\NewsController@destroyReport' - ); + /** + * Appearance + */ + Route::get('/admin/settings/appearance', 'Admin\AppearanceController@index'); + Route::post('/admin/settings/appearance/slider/images/', 'Admin\AppearanceController@sliderUpload'); + Route::post('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderUpdate'); + Route::delete('/admin/settings/appearance/slider/images/{image}', 'Admin\AppearanceController@sliderDelete'); + Route::get('/admin/settings/appearance/css/recompile', 'Admin\AppearanceController@cssRecompile'); + Route::get('/admin/settings/appearance/css/updatedatabasefromfile', 'Admin\AppearanceController@cssUpdateDatabaseFromFile'); + Route::post('/admin/settings/appearance/css/override', 'Admin\AppearanceController@cssOverride'); + Route::post('/admin/settings/appearance/css/variables', 'Admin\AppearanceController@cssVariables'); - /** - * Polls - */ - Route::get('/admin/polls', 'Admin\PollsController@index'); - Route::post('/admin/polls', 'Admin\PollsController@store'); - Route::get('/admin/polls/{poll}', 'Admin\PollsController@show'); - Route::post('/admin/polls/{poll}', 'Admin\PollsController@update'); - Route::post('/admin/polls/{poll}/end', 'Admin\PollsController@endPoll'); - Route::delete('/admin/polls/{poll}', 'Admin\PollsController@destroy'); - Route::post('/admin/polls/{poll}/options', 'Admin\PollsController@storeOption'); - Route::delete('/admin/polls/{poll}/options/{option}', 'Admin\PollsController@destroyOption'); + /** + * News + */ + Route::get('/admin/news', 'Admin\NewsController@index'); + Route::post('/admin/news', 'Admin\NewsController@store'); + Route::get('/admin/news/{newsArticle}', 'Admin\NewsController@show'); + Route::post('/admin/news/{newsArticle}', 'Admin\NewsController@update'); + Route::delete('/admin/news/{newsArticle}', 'Admin\NewsController@destroy'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/delete', 'Admin\NewsController@destroyComment'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/approve', 'Admin\NewsController@approveComment'); + Route::get('/admin/news/{newsArticle}/comments/{newsComment}/reject', 'Admin\NewsController@rejectComment'); + Route::get( + '/admin/news/{newsArticle}/comments/{newsComment}/reports/{newsCommentReport}/delete', + 'Admin\NewsController@destroyReport' + ); - /** - * Purchases - */ - Route::get('/admin/purchases', 'Admin\PurchasesController@index'); - Route::get('/admin/purchases/shop', 'Admin\PurchasesController@showShop'); - Route::get('/admin/purchases/event', 'Admin\PurchasesController@showEvent'); - Route::get('/admin/purchases/revoked', 'Admin\PurchasesController@showRevoked'); - Route::get('/admin/purchases/{purchase}/setSuccess', 'Admin\PurchasesController@setSuccess'); - Route::get('/admin/purchases/{purchase}', 'Admin\PurchasesController@show'); - if (config('admin.super_danger_zone')) { - Route::delete('/admin/purchases/{purchase}', 'Admin\PurchasesController@delete'); - } + /** + * Polls + */ + Route::get('/admin/polls', 'Admin\PollsController@index'); + Route::post('/admin/polls', 'Admin\PollsController@store'); + Route::get('/admin/polls/{poll}', 'Admin\PollsController@show'); + Route::post('/admin/polls/{poll}', 'Admin\PollsController@update'); + Route::post('/admin/polls/{poll}/end', 'Admin\PollsController@endPoll'); + Route::delete('/admin/polls/{poll}', 'Admin\PollsController@destroy'); + Route::post('/admin/polls/{poll}/options', 'Admin\PollsController@storeOption'); + Route::delete('/admin/polls/{poll}/options/{option}', 'Admin\PollsController@destroyOption'); - /** - * Credit System - */ - Route::get('/admin/credit', 'Admin\CreditController@index'); - Route::post('/admin/credit/edit', 'Admin\CreditController@edit'); - Route::post('/admin/credit/settings', 'Admin\CreditController@settings'); + /** + * Purchases + */ + Route::get('/admin/purchases', 'Admin\PurchasesController@index'); + Route::get('/admin/purchases/shop', 'Admin\PurchasesController@showShop'); + Route::get('/admin/purchases/event', 'Admin\PurchasesController@showEvent'); + Route::get('/admin/purchases/revoked', 'Admin\PurchasesController@showRevoked'); + Route::get('/admin/purchases/{purchase}/setSuccess', 'Admin\PurchasesController@setSuccess'); + Route::get('/admin/purchases/{purchase}', 'Admin\PurchasesController@show'); + if (config('admin.super_danger_zone')) { + Route::delete('/admin/purchases/{purchase}', 'Admin\PurchasesController@delete'); + } - /** - * Shop - */ - Route::get('/admin/shop', 'Admin\ShopController@index'); - Route::post('/admin/shop/item', 'Admin\ShopController@storeItem'); - Route::post('/admin/shop/category', 'Admin\ShopController@storeCategory'); - Route::get('/admin/shop/{category}', 'Admin\ShopController@showCategory'); - Route::post('/admin/shop/{category}', 'Admin\ShopController@updateCategory'); - Route::delete('/admin/shop/{category}', 'Admin\ShopController@deleteCategory'); - Route::get('/admin/shop/{category}/{item}', 'Admin\ShopController@showItem'); - Route::post('/admin/shop/{category}/{item}', 'Admin\ShopController@updateItem'); - Route::delete('/admin/shop/{category}/{item}', 'Admin\ShopController@deleteItem'); - Route::post('/admin/shop/{category}/{item}/images', 'Admin\ShopController@uploadItemImage'); - Route::post('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@updateItemImage'); - Route::delete('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@deleteItemImage'); + /** + * Credit System + */ + Route::get('/admin/credit', 'Admin\CreditController@index'); + Route::post('/admin/credit/edit', 'Admin\CreditController@edit'); + Route::post('/admin/credit/settings', 'Admin\CreditController@settings'); - /** - * Orders - */ - Route::get('/admin/orders', 'Admin\OrdersController@index'); - Route::get('/admin/orders/{order}', 'Admin\OrdersController@show'); - Route::post('/admin/orders/{order}/processing', 'Admin\OrdersController@setAsProcessing'); - Route::post('/admin/orders/{order}/shipped', 'Admin\OrdersController@setAsShipped'); - Route::post('/admin/orders/{order}/tracking', 'Admin\OrdersController@updateTrackingDetails'); - Route::post('/admin/orders/{order}/complete', 'Admin\OrdersController@setAsComplete'); - Route::post('/admin/orders/{order}/cancel', 'Admin\OrdersController@setAsCancelled'); - }); + /** + * Shop + */ + Route::get('/admin/shop', 'Admin\ShopController@index'); + Route::post('/admin/shop/item', 'Admin\ShopController@storeItem'); + Route::post('/admin/shop/category', 'Admin\ShopController@storeCategory'); + Route::get('/admin/shop/{category}', 'Admin\ShopController@showCategory'); + Route::post('/admin/shop/{category}', 'Admin\ShopController@updateCategory'); + Route::delete('/admin/shop/{category}', 'Admin\ShopController@deleteCategory'); + Route::get('/admin/shop/{category}/{item}', 'Admin\ShopController@showItem'); + Route::post('/admin/shop/{category}/{item}', 'Admin\ShopController@updateItem'); + Route::delete('/admin/shop/{category}/{item}', 'Admin\ShopController@deleteItem'); + Route::post('/admin/shop/{category}/{item}/images', 'Admin\ShopController@uploadItemImage'); + Route::post('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@updateItemImage'); + Route::delete('/admin/shop/{category}/{item}/images/{image}', 'Admin\ShopController@deleteItemImage'); + + /** + * Orders + */ + Route::get('/admin/orders', 'Admin\OrdersController@index'); + Route::get('/admin/orders/{order}', 'Admin\OrdersController@show'); + Route::post('/admin/orders/{order}/processing', 'Admin\OrdersController@setAsProcessing'); + Route::post('/admin/orders/{order}/shipped', 'Admin\OrdersController@setAsShipped'); + Route::post('/admin/orders/{order}/tracking', 'Admin\OrdersController@updateTrackingDetails'); + Route::post('/admin/orders/{order}/complete', 'Admin\OrdersController@setAsComplete'); + Route::post('/admin/orders/{order}/cancel', 'Admin\OrdersController@setAsCancelled'); }); }); diff --git a/src/app/Libraries/Helpers.php b/src/app/Libraries/Helpers.php index 56131840..3893703c 100644 --- a/src/app/Libraries/Helpers.php +++ b/src/app/Libraries/Helpers.php @@ -10,6 +10,7 @@ use DB; use App\GameServerCommandParameter; use App\EventTournament; +use App\EventParticipant; use App\User; use App\GameServer; use GuzzleHttp\Client; @@ -20,9 +21,33 @@ use Illuminate\Support\Collection; use Illuminate\Pagination\LengthAwarePaginator; use HaydenPierce\ClassFinder\ClassFinder; - + class Helpers { + + + /** + * Gets an array of all supported languages from the language directory. + * + * @return array + */ + public static function getSupportedLocales() + { + return array_map('basename', array_filter(glob(app()->langPath().'/*'), 'is_dir')); + } + + + /** + * Validate if the given locale exists in the supported languages. + * + * @param string $locale + * @return bool + */ + public static function isValidLocale($locale) + { + return in_array($locale, self::getSupportedLocales()); + } + // TODO - refactor - eg getGameSelectArray - specifially the selectArray part /** * Get Venues @@ -146,91 +171,66 @@ public static function getEventTotal() return Settings::getEventCountOffset() + $events; } - // TODO - move to model /** - * Get Next Event Name - * @return String + * Get Next Event Name. + * + * @return string */ public static function getNextEventName() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - if ($event->status == 'DRAFT' || $event->status == 'PREVIEW') { - return $event->display_name . ' - ' . $event->status; - } - return $event->display_name; + if ($event = Event::nextUpcoming()->first()) { + return ($event->status == 'DRAFT' || $event->status == 'PREVIEW') + ? $event->display_name . ' - ' . $event->status + : $event->display_name; } return 'Coming soon...'; } /** - * Get Next Event Slug - * @return String + * Get Next Event Slug. + * + * @return string */ public static function getNextEventSlug() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return $event->slug; - } - return '#'; + return ($event = Event::nextUpcoming()->first()) ? $event->slug : '#'; } - /** - * Get Next Event Description - * @return String + * Get Next Event Description. + * + * @return string */ public static function getNextEventDesc() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return $event->desc_long; - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) ? $event->desc_long : 'Coming soon...'; } /** - * Get Next Event Start Date - * @return String + * Get Next Event Start Date. + * + * @return string */ public static function getNextEventStartDate() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return date("d-m-Y H:i", strtotime($event->start)); - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) + ? date("d-m-Y H:i", strtotime($event->start)) + : 'Coming soon...'; } /** - * Get Next Event End Date - * @return String + * Get Next Event End Date. + * + * @return string */ public static function getNextEventEndDate() { - if ($event = \App\Event::where( - 'end', - '>=', - Carbon::now() - )->orderBy(DB::raw('ABS(DATEDIFF(events.end, NOW()))'))->first()) { - return date("d-m-Y H:i", strtotime($event->end)); - } - return 'Coming soon...'; + return ($event = Event::nextUpcoming()->first()) + ? date("d-m-Y H:i", strtotime($event->end)) + : 'Coming soon...'; } + /** * Get Total Event Participants Count * @return Integer @@ -960,26 +960,59 @@ public static function getPoweredByLine() } public static function getSeoKeywords() { - return explode(',',config('settings.seo_keywords'). ',Lan2Play Eventula Manager'); - } - + return explode(',', config('settings.seo_keywords') . ',Lan2Play Eventula Manager'); + } + public static function getSeoDescription() { - return config('settings.org_tagline'). Helpers::getPoweredByLine(); + return config('settings.org_tagline') . Helpers::getPoweredByLine(); } public static function getSeoCustomDescription($description) { - return $description. Helpers::getPoweredByLine(); + return $description . Helpers::getPoweredByLine(); } - public static function getExistingSeatingPlansSelect() { + public static function getExistingSeatingPlansSelect() + { $result = []; - foreach(EventSeatingPlan::all(['id', 'name', 'event_id']) as $plan) { + foreach (EventSeatingPlan::all(['id', 'name', 'event_id']) as $plan) { $event = Event::where('id', $plan->event_id)->first(); $result[$event->display_name] ??= []; $result[$event->display_name][$plan->id] = $plan->name; } return $result; } + + /** + * Get top attendees by event count. + * + * @param int $count + * @return Collection + */ + public static function getTopAttendees(int $count = 5): Collection + { + $users = User::where('admin', 0)->get(); + return $users->filter(function ($user) { + return $user->unique_attended_event_count > 0; + }) + ->sortByDesc('unique_attended_event_count') + ->take($count); + } + + /** + * Get top winners by win count. + * + * @param int $count + * @return Collection + */ + public static function getTopWinners(int $count = 5): Collection + { + $users = User::all(); + return $users->filter(function ($user) { + return $user->win_count > 0; + }) + ->sortByDesc('win_count') + ->take($count); + } } diff --git a/src/app/Libraries/Settings.php b/src/app/Libraries/Settings.php index 9356f0a5..f5a269db 100644 --- a/src/app/Libraries/Settings.php +++ b/src/app/Libraries/Settings.php @@ -1043,4 +1043,35 @@ public static function disableAuthAllowEmailChange() { return \App\Setting::disableAuthAllowEmailChange(); } + + + + /** + * Is user_locale Enabled + * @return Boolean + */ + public static function isUserLocaleEnabled() + { + return \App\Setting::isUserLocaleEnabled(); + } + + /** + * Enable user_locale + * @return Boolean + */ + public static function enableUserLocale() + { + return \App\Setting::enableUserLocale(); + } + + /** + * Disable user_locale + * @return Boolean + */ + public static function disableUserLocale() + { + return \App\Setting::disableUserLocale(); + } + + } diff --git a/src/app/NewsArticle.php b/src/app/NewsArticle.php index b7333ee9..7a10491c 100644 --- a/src/app/NewsArticle.php +++ b/src/app/NewsArticle.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Database\Eloquent\Builder; class NewsArticle extends Model { @@ -28,6 +29,18 @@ class NewsArticle extends Model 'created_at', ); + /** + * Scope a query to get the latest news articles. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param int $limit + * @return \Illuminate\Database\Eloquent\Builder + */ + public function scopeLatestArticles(Builder $query, int $limit = 2): Builder + { + return $query->orderBy('created_at', 'desc')->limit($limit); + } + /* * Relationships */ @@ -103,4 +116,8 @@ public function getTags($separator = ', ') { return implode($separator, $this->tags->pluck('tag')->toArray()); } + + + + } diff --git a/src/app/Purchase.php b/src/app/Purchase.php index ede25789..22b7d1a4 100644 --- a/src/app/Purchase.php +++ b/src/app/Purchase.php @@ -68,6 +68,9 @@ public function getPurchaseType() break; case 'free': return 'free'; + break; + case 'system': + return 'System (Free)'; break; case 'onsite': return 'onsite'; diff --git a/src/app/Rules/ValidLocale.php b/src/app/Rules/ValidLocale.php new file mode 100644 index 00000000..b6bd9823 --- /dev/null +++ b/src/app/Rules/ValidLocale.php @@ -0,0 +1,23 @@ +first()->value; } + + + /** + * Is user_locale Enabled + * @return Boolean + */ + public static function isUserLocaleEnabled() + { + return self::where('setting', 'user_locale_enabled')->first()->value; + } + + /** + * Enable user_locale + * @return Boolean + */ + public static function enableUserLocale() + { + if (!$UserLocaleEnabled = self::where('setting', 'user_locale_enabled')->first()) { + return false; + } + $UserLocaleEnabled->value = true; + if (!$UserLocaleEnabled->save()) { + return false; + } + return true; + } + + /** + * Disable user_locale + * @return Boolean + */ + public static function disableUserLocale() + { + if (!$UserLocaleEnabled = self::where('setting', 'user_locale_enabled')->first()) { + return false; + } + $UserLocaleEnabled->value = false; + if (!$UserLocaleEnabled->save()) { + return false; + } + return true; + } + + + } diff --git a/src/app/User.php b/src/app/User.php index 8014ca4c..740cb0a2 100644 --- a/src/app/User.php +++ b/src/app/User.php @@ -15,6 +15,8 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Database\Eloquent\Casts\Attribute; +use Illuminate\Database\Eloquent\Builder; use Debugbar; use Laravel\Sanctum\HasApiTokens; @@ -35,10 +37,12 @@ class User extends Authenticatable implements MustVerifyEmail 'username_nice', 'steamname', 'username', - 'avatar', + 'steam_avatar', + 'local_avatar', 'steamid', 'last_login', - 'email_verified_at' + 'email_verified_at', + 'locale' ]; /** @@ -51,6 +55,17 @@ class User extends Authenticatable implements MustVerifyEmail 'remember_token', ]; + /** + * The accessors to append to the model's array form. + * + * @var array + */ + protected $appends = [ + 'unique_attended_event_count', + 'win_count', + 'avatar' + ]; + public static function boot() { parent::boot(); @@ -78,7 +93,6 @@ public function matchMakingTeamplayers() public function matchMakingTeams() { return $this->hasManyThrough('App\MatchMakingTeam', 'App\MatchMakingTeamPlayer', 'user_id', 'id', 'id', 'matchmaking_team_id'); - } public function purchases() { @@ -106,12 +120,9 @@ public function getAdmin() public function setActiveEventParticipant($event) { // TODO Enable signed in again depending on tournament setting - if ($event->online_event) - { + if ($event->online_event) { $clauses = ['user_id' => $this->id]; - } - else - { + } else { $clauses = ['user_id' => $this->id, 'signed_in' => true]; } @@ -119,28 +130,21 @@ public function setActiveEventParticipant($event) $freeparticipant = EventParticipant::where('free', true)->where($clauses)->orderBy('updated_at', 'DESC')->first(); - if (isset($payedparticipant) && isset($freeparticipant)) - { - if ($payedparticipant->updated_at->greaterThan($freeparticipant->updated_at)) - { + if (isset($payedparticipant) && isset($freeparticipant)) { + if ($payedparticipant->updated_at->greaterThan($freeparticipant->updated_at)) { $this->active_event_participant = $payedparticipant; - } - else - { + } else { $this->active_event_participant = $freeparticipant; } } - if (!isset($payedparticipant) && isset($freeparticipant)) - { + if (!isset($payedparticipant) && isset($freeparticipant)) { $this->active_event_participant = $freeparticipant; - } - if (isset($payedparticipant) && !isset($freeparticipant)) - { + } + if (isset($payedparticipant) && !isset($freeparticipant)) { $this->active_event_participant = $payedparticipant; } Debugbar::addMessage("active_event_participant: " . json_encode($this->active_event_participant), 'setActiveEventParticipant'); - } /** @@ -168,7 +172,8 @@ public function getStaffTickets($eventId) /** * Get all Tickets for current user */ - public function getAllTickets($eventId, $includeRevoked = false) { + public function getAllTickets($eventId, $includeRevoked = false) + { $clauses = ['user_id' => $this->id, 'event_id' => $eventId]; if (!$includeRevoked) { $clauses['revoked'] = 0; @@ -178,18 +183,19 @@ public function getAllTickets($eventId, $includeRevoked = false) { } /** - * User has at least one seatable ticket for event - */ - public function hasSeatableTicket($eventId) { + * User has at least one seatable ticket for event + */ + public function hasSeatableTicket($eventId) + { $eventParticipants = $this->getAllTickets($eventId); - foreach ($eventParticipants as $eventParticipant){ - + foreach ($eventParticipants as $eventParticipant) { + if (($eventParticipant->ticket && $eventParticipant->ticket->seatable) || - ($eventParticipant->free || $eventParticipant->staff)) { + ($eventParticipant->free || $eventParticipant->staff) + ) { return true; } - } return false; } @@ -211,10 +217,10 @@ public function getTickets($eventId, $obj = false) ) { $seat = 'Not Seated'; $seatingPlanName = ""; - if ($eventParticipant->seat) { + if ($eventParticipant->seat) { if ($eventParticipant->seat->seatingPlan) { $seatingPlanName = $eventParticipant->seat->seatingPlan->getName(); - } + } $seat = $eventParticipant->seat->getName(); } $return[$eventParticipant->id] = 'Participant ID: ' . $eventParticipant->id . $seat; @@ -334,4 +340,68 @@ public function getNextEvent() return $nextEvent; } + /** + * Get the user's unique attended event count. + */ + protected function uniqueAttendedEventCount(): Attribute + { + $attribute = Attribute::make( + get: fn() => $this->eventParticipants() + ->whereHas('event', function (Builder $query) { + $query->whereIn('status', ['PUBLISHED', 'REGISTEREDONLY']) + ->where('end', '<=', Carbon::today()); + }) + ->select(\DB::raw('COUNT(DISTINCT event_id) as unique_attended_event_count')) + ->value('unique_attended_event_count') ?? 0 + ); + + return $attribute; + } + + /** + * Get the user's win count. + */ + protected function winCount(): Attribute + { + return Attribute::make( + get: fn() => $this->calculateWinCount() + ); + } + + /** + * Get the user's avatar. + */ + protected function avatar(): Attribute + { + $default_avatar = "storage/images/main/default_avatar.png"; + return Attribute::make( + get: fn () => match ($this->selected_avatar) { + 'steam' => !empty($this->steam_avatar) ? $this->steam_avatar : asset($default_avatar), + 'local' => !empty($this->local_avatar) ? asset($this->local_avatar) : asset($default_avatar), + default => asset($default_avatar), + } + ); + } + + /** + * Calculate the user's win count. + * + * @return int + */ + protected function calculateWinCount(): int + { + $teamWins = EventTournamentTeam::where('final_rank', 1) + ->whereHas('tournamentParticipants.eventParticipant.user', function (Builder $query) { + $query->where('id', $this->id); + }) + ->count(); + + $individualWins = EventTournamentParticipant::where('final_rank', 1) + ->whereHas('eventParticipant.user', function (Builder $query) { + $query->where('id', $this->id); + }) + ->count(); + + return $teamWins + $individualWins; + } } diff --git a/src/config/app.php b/src/config/app.php index e567d4e1..00f6d8c6 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -121,5 +121,4 @@ 'JsonLd' => Artesaos\SEOTools\Facades\JsonLd::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, ], - ]; diff --git a/src/database/migrations/2023_11_05_131811_tournaments_staff.php b/src/database/migrations/2023_11_05_131811_tournaments_staff.php new file mode 100644 index 00000000..37f38091 --- /dev/null +++ b/src/database/migrations/2023_11_05_131811_tournaments_staff.php @@ -0,0 +1,33 @@ +boolean('tournaments_staff')->after('matchmaking_enabled')->default(false); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn('tournaments_staff'); + }); + } +}; diff --git a/src/database/migrations/2023_11_05_131817_tournaments_freebies.php b/src/database/migrations/2023_11_05_131817_tournaments_freebies.php new file mode 100644 index 00000000..a198bd6d --- /dev/null +++ b/src/database/migrations/2023_11_05_131817_tournaments_freebies.php @@ -0,0 +1,32 @@ +boolean('tournaments_freebies')->after('tournaments_staff')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn('tournaments_freebies'); + }); + } +}; diff --git a/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php b/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php new file mode 100644 index 00000000..510b87f5 --- /dev/null +++ b/src/database/migrations/2023_11_05_164111_add_locale_to_users_table.php @@ -0,0 +1,28 @@ +string('locale')->default('en'); // Assuming 'en' is the default language + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('locale'); // This will remove the 'language' column + }); + } +}; diff --git a/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php b/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php new file mode 100644 index 00000000..9d503c89 --- /dev/null +++ b/src/database/migrations/2024_11_13_184725_rename_avatar_column_on_users_table.php @@ -0,0 +1,31 @@ +renameColumn('avatar', 'steam_avatar'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->renameColumn('steam_avatar', 'avatar'); + }); + } +}; diff --git a/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php b/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php new file mode 100644 index 00000000..30d8c10d --- /dev/null +++ b/src/database/migrations/2024_11_13_185059_add_local_avatar_to_users_table.php @@ -0,0 +1,28 @@ +string('local_avatar')->after('password')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('local_avatar'); + }); + } +}; diff --git a/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php b/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php new file mode 100644 index 00000000..f2d3cf84 --- /dev/null +++ b/src/database/migrations/2024_11_13_185500_add_selected_avatar_to_users_table.php @@ -0,0 +1,29 @@ +enum('selected_avatar', array('local','steam'))->after('password')->default('steam'); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('selected_avatar'); + }); + } +}; diff --git a/src/database/seeders/RequiredDatabaseSeeder.php b/src/database/seeders/RequiredDatabaseSeeder.php index 0f7ccc0a..7488e2aa 100644 --- a/src/database/seeders/RequiredDatabaseSeeder.php +++ b/src/database/seeders/RequiredDatabaseSeeder.php @@ -389,6 +389,14 @@ public function run() 'description' => 'Locale that is used for all the Site Default Texts' ] ); + Setting::firstOrCreate( + ['setting' => 'user_locale_enabled'], + [ + 'value' => true, + 'default' => true, + 'description' => 'Enable Users to set different locale in their profile settings' + ] + ); Setting::firstOrCreate( ['setting' => 'systems_matchmaking_publicuse'], [ diff --git a/src/database/seeders/SettingsTableSeeder.php b/src/database/seeders/SettingsTableSeeder.php index 03aa330d..3a8fe81c 100644 --- a/src/database/seeders/SettingsTableSeeder.php +++ b/src/database/seeders/SettingsTableSeeder.php @@ -378,6 +378,14 @@ public function run() 'description' => 'Locale that is used for all the Site Default Texts' ] ); + Setting::firstOrCreate( + ['setting' => 'user_locale_enabled'], + [ + 'value' => true, + 'default' => true, + 'description' => 'Enable Users to set different locale in their profile settings' + ] + ); Setting::firstOrCreate( ['setting' => 'systems_matchmaking_publicuse'], [ diff --git a/src/lang/de/accounts.php b/src/lang/de/accounts.php index ae1011e4..51569bf3 100644 --- a/src/lang/de/accounts.php +++ b/src/lang/de/accounts.php @@ -27,6 +27,7 @@ 'credit_item' => 'Artikel', 'credit_reason' => 'Grund', 'credit_timestamp' => 'Zeitpunkt', + 'credit' => 'Credit', 'tickets' => 'Tickets', 'no_tickets' => 'Du hast im Moment keine Tickets.', 'purchases' => 'Käufe', @@ -92,4 +93,9 @@ 'new_token_wizzard_del_failed' => 'Das Löschen des alten Tokens ist fehlgeschlagen. Bitte versuche es noch einmal.', 'new_token_wizzard_creation_failed' => 'Das Erstellen des Tokens ist fehlgeschlagen. Bitte versuche es noch einmal.', 'new_token_wizzard_clickoncallback' => 'Du kannst auf Zurück verbinden klicken oder den Token manuell kopieren.', + 'locale' => 'Sprache', + 'avatarsettings' => 'Avatar Einstellungen', + 'avatardescription' => 'Du kannst deinen Steam Avatar verwenden (wenn dein Steam Account gekoppelt ist) oder einen eigenen Avatar hochladen', + 'avatarsteam' => 'Benutze Steam Avatar', + 'avatarlocal' => 'Benutze Eigenen Avatar', ]; diff --git a/src/lang/de/events.php b/src/lang/de/events.php index e25f1086..e633cf39 100644 --- a/src/lang/de/events.php +++ b/src/lang/de/events.php @@ -43,7 +43,7 @@ /* Index */ 'start' => 'Start', 'end' => 'Ende', - 'seatingcapacity' => 'Sitzplatz Kapazitäten', + 'seatingcapacity' => 'Sitzplatz Kapazität', /* Show */ 'eventinfo' => 'Event Informationen', 'tickets' => 'Tickets', @@ -117,6 +117,13 @@ 'tournament_cannot_remove' => 'Löschvorgang konnte nicht abgeschlossen werden. Bitte versuch es erneut.', 'tournament_sucessfully_removed' => 'Du wurdest erfolgreich vom Turnier abgemeldet.', 'tournament_cannot_join_thirdparty' => 'Du kannst dich für dieses Turnier nicht anmelden, da die notwendige Authentifizierung zu einem Drittherstellerdienst in deinem Konto nicht hergestellt ist. Prüfe die Single Sign-On Einstellungen in deinem Profil', + 'tournament_staff_not_permitted' => 'Die Teilnahme an Turnieren von Orgas ist auf diesem Event nicht erlaubt', + 'tournament_freebie_not_permitted' => 'Die Teilnahme an Turnieren von Freebies ist auf diesem Event nicht erlaubt', /* Ticket Partial*/ 'remove_seating' => 'Sitzplatz entfernen', + + /* General */ + 'time_delimiter' => 'um', + 'time_suffix' => 'Uhr', + 'savetocalendar' => 'In Kalender speichern' ]; diff --git a/src/lang/en/accounts.php b/src/lang/en/accounts.php index a6ca2168..304afb2e 100644 --- a/src/lang/en/accounts.php +++ b/src/lang/en/accounts.php @@ -27,6 +27,7 @@ 'credit_item' => 'Item', 'credit_reason' => 'Reason', 'credit_timestamp' => 'Timestamp', + 'credit' => 'Credit', 'tickets' => 'Tickets', 'no_tickets' => 'You currently have no tickets.', 'purchases' => 'Purchases', @@ -92,4 +93,10 @@ 'new_token_wizzard_del_failed' => 'Deletion of the old token failed. Please try again.', 'new_token_wizzard_creation_failed' => 'Creation of the token failed. Please try again.', 'new_token_wizzard_clickoncallback' => 'You can now click on the connect back button or you can copy the token manually to your application.', + 'locale' => 'Language', + 'avatarsettings' => 'Avatar Settings', + 'avatardescription' => 'You can use your Steam Avatar or upload a custom one.', + 'avatarsteam' => 'Use Steam Avatar', + 'avatarlocal' => 'Upload a Custom Avatar', + ]; diff --git a/src/lang/en/events.php b/src/lang/en/events.php index e2055941..8d721081 100644 --- a/src/lang/en/events.php +++ b/src/lang/en/events.php @@ -117,6 +117,13 @@ 'tournament_cannot_remove' => 'Cannot remove. Please try again.', 'tournament_sucessfully_removed' => 'You have been successfully removed from the Tournament.', 'tournament_cannot_join_thirdparty' => 'you cannot sign up for this tournament because the nessecary third party account link on your user is missing. Please check your signle sign-on settings in your profile.', + 'tournament_staff_not_permitted' => 'Tournament participation of staff members is not allowed at this event.', + 'tournament_freebie_not_permitted' => 'Tournament participation of freebies is not allowed at this event.', /* Ticket Partial*/ 'remove_seating' => 'Remove Seating', + + /* General */ + 'time_delimiter' => 'at', + 'time_suffix' => '', + 'savetocalendar' => 'Save to Calendar' ]; diff --git a/src/resources/assets/images/default_avatar.png b/src/resources/assets/images/default_avatar.png new file mode 100644 index 00000000..04193bc5 Binary files /dev/null and b/src/resources/assets/images/default_avatar.png differ diff --git a/src/resources/views/accounts/index.blade.php b/src/resources/views/accounts/index.blade.php index 7e8f18cd..a6ab4729 100644 --- a/src/resources/views/accounts/index.blade.php +++ b/src/resources/views/accounts/index.blade.php @@ -1,376 +1,451 @@ @extends ('layouts.default') -@section ('page_title', __('accounts.accounts_title')) - -@section ('content') - -
@lang('accounts.credit_action') | -@lang('accounts.credit_amount') | -@lang('accounts.credit_item') | -@lang('accounts.credit_reason') | -@lang('accounts.credit_timestamp') | -
---|---|---|---|---|
{{ $creditLog->action }} | -{{ $creditLog->amount }} | -
- @if (strtolower($creditLog->action) == 'buy')
- @if (!$creditLog->purchase->participants->isEmpty())
- @foreach ($creditLog->purchase->participants as $participant)
- {{ $participant->event->display_name }} - {{ $participant->ticket->name }}
- @if (!$loop->last)
- - @endif - @endforeach - @elseif ($creditLog->purchase->order != null) - @foreach ($creditLog->purchase->order->items as $item) - @if ($item->item) - {{ $item->item->name }} - @endif - - x {{ $item->quantity }} - - @if ($item->price != null) - {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} - @if ($item->price_credit != null && Settings::isCreditEnabled()) - / - @endif - @endif - @if ($item->price_credit != null && Settings::isCreditEnabled()) - {{ $item->price_credit * $item->quantity }} Credits - @endif - @if (!$loop->last) - - @endif - @endforeach - @endif - @endif - |
- {{ $creditLog->reason }} | -- {{ $creditLog->updated_at }} - | -
- @lang('accounts.purchases_id') - | -- @lang('accounts.purchases_method') - | -- @lang('accounts.purchases_time') - | -- @lang('accounts.purchases_basket') - | -
---|---|---|---|
- {{ $purchase->id }} - | -- {{ $purchase->getPurchaseType() }} - | -- {{ date('d-m-y H:i', strtotime($purchase->created_at)) }} - | -
- @if (!$purchase->participants->isEmpty())
- @foreach ($purchase->participants as $participant)
- {{ $participant->event->display_name }} - {{ $participant->ticket->name }}
- @if (!$loop->last)
- - @endif - @endforeach - @elseif ($purchase->order != null) - @foreach ($purchase->order->items as $item) - @if ($item->item) - {{ $item->item->name }} - @endif - - x {{ $item->quantity }} - - @if ($item->price != null) - {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} - @if ($item->price_credit != null && Settings::isCreditEnabled()) - / - @endif - @endif - @if ($item->price_credit != null && Settings::isCreditEnabled()) - {{ $item->price_credit * $item->quantity }} Credits - @endif - @if (!$loop->last) - - @endif - @endforeach - @endif - |
-
- @lang('accounts.token_id') - | -- @lang('accounts.token_name') - | -- @lang('accounts.token_lastuse_date') - | -- @lang('accounts.token_creation_date') - | -- | -
---|---|---|---|---|
- {{ $token->id }} - | -- {{ $token->name }} - | -- @if ($token->last_used_at) - {{ date('d-m-y H:i', strtotime($token->last_used_at)) }} - @else - @lang('accounts.token_never_used') - @endif - | -- {{ date('d-m-y H:i', strtotime($token->created_at)) }} - | -- {{ Form::open(array('url'=>'/account/tokens/remove/' . $token->id, 'onsubmit' => 'return ConfirmDeleteToken()')) }} - {{ Form::hidden('_method', 'DELETE') }} - - {{ Form::close() }} - | -
@lang('accounts.avatardescription')
+@lang('accounts.credit_action') | +@lang('accounts.credit_amount') | +@lang('accounts.credit_item') | +@lang('accounts.credit_reason') | +@lang('accounts.credit_timestamp') | +
---|---|---|---|---|
{{ $creditLog->action }} | +{{ $creditLog->amount }} | +
+ @if (strtolower($creditLog->action) == 'buy')
+ @if (!$creditLog->purchase->participants->isEmpty())
+ @foreach ($creditLog->purchase->participants as $participant)
+ {{ $participant->event->display_name }} -
+ {{ $participant->ticket->name }}
+ @if (!$loop->last)
+ + @endif + @endforeach + @elseif ($creditLog->purchase->order != null) + @foreach ($creditLog->purchase->order->items as $item) + @if ($item->item) + {{ $item->item->name }} + @endif + - x {{ $item->quantity }} + + @if ($item->price != null) + {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} + @if ($item->price_credit != null && Settings::isCreditEnabled()) + / + @endif + @endif + @if ($item->price_credit != null && Settings::isCreditEnabled()) + {{ $item->price_credit * $item->quantity }} Credits + @endif + @if (!$loop->last) + + @endif + @endforeach + @endif + @endif + |
+ {{ $creditLog->reason }} | ++ {{ $creditLog->updated_at }} + | +
+ @lang('accounts.purchases_id') + | ++ @lang('accounts.purchases_method') + | ++ @lang('accounts.purchases_time') + | ++ @lang('accounts.purchases_basket') + | +
---|---|---|---|
+ {{ $purchase->id }} + | ++ {{ $purchase->getPurchaseType() }} + | ++ {{ date('d-m-y H:i', strtotime($purchase->created_at)) }} + | +
+ @if (!$purchase->participants->isEmpty())
+ @foreach ($purchase->participants as $participant)
+ @if ($participant->free)
+ {{ $participant->event->display_name }} - Freebie
+ @elseif($participant->staff)
+ {{ $participant->event->display_name }} - Staff
+ @else
+ {{ $participant->event->display_name }} -
+ {{ $participant->ticket->name }}
+ @endif
+ @if (!$loop->last)
+ + @endif + @endforeach + @elseif ($purchase->order != null) + @foreach ($purchase->order->items as $item) + @if ($item->item) + {{ $item->item->name }} + @endif + - x {{ $item->quantity }} + + @if ($item->price != null) + {{ Settings::getCurrencySymbol() }}{{ $item->price * $item->quantity }} + @if ($item->price_credit != null && Settings::isCreditEnabled()) + / + @endif + @endif + @if ($item->price_credit != null && Settings::isCreditEnabled()) + {{ $item->price_credit * $item->quantity }} Credits + @endif + @if (!$loop->last) + + @endif + @endforeach + @endif + |
+
+ @lang('accounts.token_id') + | ++ @lang('accounts.token_name') + | ++ @lang('accounts.token_lastuse_date') + | ++ @lang('accounts.token_creation_date') + | ++ | +
---|---|---|---|---|
+ {{ $token->id }} + | ++ {{ $token->name }} + | ++ @if ($token->last_used_at) + {{ date('d-m-y H:i', strtotime($token->last_used_at)) }} + @else + @lang('accounts.token_never_used') + @endif + | ++ {{ date('d-m-y H:i', strtotime($token->created_at)) }} + | ++ {{ Form::open(['url' => '/account/tokens/remove/' . $token->id, 'onsubmit' => 'return ConfirmDeleteToken()']) }} + {{ Form::hidden('_method', 'DELETE') }} + + {{ Form::close() }} + | +
@lang('accounts.email') | - @if ($user->email && $user->email != "") -@lang('accounts.setted') | - @else -@lang('accounts.notsetted') | - @endif -
@lang('accounts.password') | - @if ($user->password && $user->password != "") -@lang('accounts.setted') | - @else -@lang('accounts.notsetted') | - @endif -
@lang('accounts.ssochangeemailmessage')
- @else -@lang('accounts.ssodontemailmessage')
- @endif - @else -@lang('accounts.ssoemailmessage')
- @endif - -@lang('accounts.ssochangpasswordmessage')
- @else -@lang('accounts.ssopasswordmessage')
- @endif - -@lang('accounts.email') | + @if ($user->email && $user->email != '') +@lang('accounts.setted') | + @else +@lang('accounts.notsetted') | + @endif +
@lang('accounts.password') | + @if ($user->password && $user->password != '') +@lang('accounts.setted') | + @else +@lang('accounts.notsetted') | + @endif +
@lang('accounts.ssochangeemailmessage')
+ @else +@lang('accounts.ssodontemailmessage')
+ @endif + @else +@lang('accounts.ssoemailmessage')
+ @endif + +@lang('accounts.ssochangpasswordmessage')
+ @else +@lang('accounts.ssopasswordmessage')
+ @endif + +Setting | -Value | -- | - |
---|---|---|---|
- {{ ucwords(str_replace("_"," ",$setting->setting)) }} - @if ($setting->description != null) - {{ $setting->description }} - @endif - |
- - {{ Form::text($setting->setting, $setting->value ,array('id'=>'setting' . $key,'class'=>'form-control')) }} - | -- - | - {{ Form::close() }} - {{ Form::open(array('url'=>'/admin/settings/', 'onsubmit' => 'return ConfirmDelete()')) }} -- @if (!$setting->default) - {{ Form::hidden('_method', 'DELETE') }} - - @endif - | - {{ Form::close() }} -
The Shop can be used for buying merch, consumables etc.
- @if ($isShopEnabled) - {{ Form::open(array('url'=>'/admin/settings/shop/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/shop/enable')) }} - - {{ Form::close() }} - @endif -The Credit System is used to award participants with credit they can use to buy things from the shop and events. It can be award for buying tickets, attending events, participanting/winning tournaments or manually assigned.
- @if ($isCreditEnabled) - {{ Form::open(array('url'=>'/admin/settings/credit/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/credit/enable')) }} - - {{ Form::close() }} - @endif -The Gallery can be used for uploading pictures.
- @if ($isGalleryEnabled) - {{ Form::open(array('url'=>'/admin/settings/gallery/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/gallery/enable')) }} - - {{ Form::close() }} - @endif -Setting | +Value | ++ | + |
---|---|---|---|
+ {{ ucwords(str_replace('_', ' ', $setting->setting)) }} + @if ($setting->description != null) + {{ $setting->description }} + @endif + |
+ + {{ Form::text($setting->setting, $setting->value, ['id' => 'setting' . $key, 'class' => 'form-control']) }} + | ++ + | + {{ Form::close() }} + {{ Form::open(['url' => '/admin/settings/', 'onsubmit' => 'return ConfirmDelete()']) }} ++ @if (!$setting->default) + {{ Form::hidden('_method', 'DELETE') }} + + @endif + | + {{ Form::close() }} +
The Help System can be used to populate help articles.
- @if ($isHelpEnabled) - {{ Form::open(array('url'=>'/admin/settings/help/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/help/enable')) }} - - {{ Form::close() }} - @endif -Setting | +Value | ++ |
---|---|---|
+ {{ ucwords(str_replace('_', ' ', $settings->firstWhere('setting', 'site_locale')->setting)) }} + @if ($settings->firstWhere('setting', 'site_locale')->description != null) + {{ $settings->firstWhere('setting', 'site_locale')->description }} + @endif + |
+
-
-
-
+
+
- Matchmaking System
-
-
-
- The Matchmaking feature can be used to make matches by admins or users without the need of an event tournament. - @if ($isMatchMakingEnabled) - {{ Form::open(array('url'=>'/admin/settings/matchmaking/disable')) }} - - {{ Form::close() }} - @else - {{ Form::open(array('url'=>'/admin/settings/matchmaking/enable')) }} - - {{ Form::close() }} - @endif - |
+ + + | + {{ Form::close() }} - -
+ {{ ucwords(str_replace('_', ' ', $settings->firstWhere('setting', 'user_locale_enabled')->setting)) }} + @if ($settings->firstWhere('setting', 'user_locale_enabled')->description != null) + {{ $settings->firstWhere('setting', 'user_locale_enabled')->description }} + @endif + |
+ + @if (Settings::isUserLocaleEnabled()) + + @else + + @endif + | ++ + @if (Settings::isUserLocaleEnabled()) + {{ Form::open(['url' => '/admin/settings/userlocale/disable', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/userlocale/enable', 'onsubmit' => 'return ConfirmSubmit()']) }} + + {{ Form::close() }} + @endif + + | + +
The Shop can be used for buying merch, consumables etc.
+ @if ($isShopEnabled) + {{ Form::open(['url' => '/admin/settings/shop/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/shop/enable']) }} + + {{ Form::close() }} + @endif +The Credit System is used to award participants with credit they can use to buy things from the shop + and events. It can be award for buying tickets, attending events, participanting/winning tournaments + or manually assigned.
+ @if ($isCreditEnabled) + {{ Form::open(['url' => '/admin/settings/credit/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/credit/enable']) }} + + {{ Form::close() }} + @endif +The Gallery can be used for uploading pictures.
+ @if ($isGalleryEnabled) + {{ Form::open(['url' => '/admin/settings/gallery/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/gallery/enable']) }} + + {{ Form::close() }} + @endif +The Help System can be used to populate help articles.
+ @if ($isHelpEnabled) + {{ Form::open(['url' => '/admin/settings/help/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/help/enable']) }} + + {{ Form::close() }} + @endif +The Matchmaking feature can be used to make matches by admins or users without the need of an event + tournament.
+ @if ($isMatchMakingEnabled) + {{ Form::open(['url' => '/admin/settings/matchmaking/disable']) }} + + {{ Form::close() }} + @else + {{ Form::open(['url' => '/admin/settings/matchmaking/enable']) }} + + {{ Form::close() }} + @endif +Link Social Media your social media accounts to publish posts and pictures from the Lan + Manager
+{!! $event->essential_info !!}
-@lang('events.start'): {{ date('H:i d-m-Y', strtotime($event->start)) }}
-@lang('events.end'): {{ date('H:i d-m-Y', strtotime($event->end)) }}
-@lang('events.seatingcapacity'): {{ $event->getSeatingCapacity() }}
-@lang('events.start'): {{ date('H:i d-m-Y', strtotime($event->start)) }}
-@lang('events.end'): {{ date('H:i d-m-Y', strtotime($event->end)) }}
-@if ($event->getSeatingCapacity() == 0) @lang('events.capacity'): {{ $event->capacity }} @endif @if ($event->getSeatingCapacity() != 0) @lang('events.seatingcapacity'): {{ $event->getSeatingCapacity() }} @endif
-{!! $event->desc_long !!}
-
- {{ Helpers::getLatinAlphabetUpperLetterByIndex($row) }}- |
- @for ($column = 1; $column <= $seatingPlan->columns; $column++)
-
- - @if ($event->getSeat($seatingPlan->id, $column, $row)) - @if($event->getSeat($seatingPlan->id, $column, $row)->status == 'ACTIVE') - @if ($seatingPlan->locked) - - @else - - @endif - @endif - @else - @if ($seatingPlan->locked) - - @else - @if (Auth::user() - && $event->getEventParticipant() - && ($event->getEventParticipant()->staff - || $event->getEventParticipant()->free - || $event->getEventParticipant()->ticket->seatable - ) - ) - - @else - - @endif - @endif - @endif - | - @endfor -
@lang('events.seatingplanlocked')
- @endif -
{{ $attendee->username }}
- {{ $attendee->event_count }} @lang('home.eventsattended')
+ {{ $attendee->unique_attended_event_count }} @lang('home.eventsattended')
@lang('events.start')
+@lang('events.end')
+@lang('events.capacity')
+@lang('events.seatingcapacity')
+{!! $event->desc_long !!}
+
+ {{ Helpers::getLatinAlphabetUpperLetterByIndex($row) }}+ |
+ @for ($column = 1; $column <= $seatingPlan->columns; $column++)
+
+ + @if ($event->getSeat($seatingPlan->id, $column, $row)) + @if($event->getSeat($seatingPlan->id, $column, $row)->status == 'ACTIVE') + @if ($seatingPlan->locked) + + @else + + @endif + @endif + @else + @if ($seatingPlan->locked) + + @else + @if (Auth::user() + && $event->getEventParticipant() + && ($event->getEventParticipant()->staff + || $event->getEventParticipant()->free + || $event->getEventParticipant()->ticket->seatable + ) + ) + + @else + + @endif + @endif + @endif + | + @endfor +
@lang('events.seatingplanlocked')
+ @endif +