57 lines
2 KiB
PHP
57 lines
2 KiB
PHP
|
@php
|
||
|
use App\Models\Game;
|
||
|
use App\Models\Platform;
|
||
|
@endphp
|
||
|
|
||
|
{{-- Check to see if the user is logged in. --}}
|
||
|
@if (Auth::check())
|
||
|
{{-- Check role of user. --}}
|
||
|
@if (
|
||
|
Auth::user()->role_id != 1 &&
|
||
|
Auth::user()->role_id != 2 &&
|
||
|
Auth::user()->role_id != 3
|
||
|
)
|
||
|
{{-- Redirect to home page. --}}
|
||
|
<script>window.location = "/";</script>
|
||
|
@endif
|
||
|
@endif
|
||
|
|
||
|
<x-base-layout>
|
||
|
<!--begin::Row-->
|
||
|
<div class="row gy-5 g-xl-8">
|
||
|
<!--begin::Col-->
|
||
|
<div class="col-xxl-8">
|
||
|
<div class="card shadow-sm mb-2">
|
||
|
<div class="card-header">
|
||
|
<h3 class="card-title">Games</h3>
|
||
|
<div class="card-toolbar">
|
||
|
<div class="input-group">
|
||
|
<input type="text" class="form-control" name="admSearch" id="admSearch" placeholder="Game ID" aria-label="" aria-describedby="">
|
||
|
<button class="input-group-text fw-light" id="searchBtn">Search</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
document.getElementById('searchBtn').onclick = function() {
|
||
|
var gameId = document.getElementById("admSearch").value;
|
||
|
location.href = "/admin/game/" + gameId + "/edit";
|
||
|
};
|
||
|
</script>
|
||
|
</div>
|
||
|
<div class="card-body">
|
||
|
@php
|
||
|
$games = Game::take(100)->orderBy('id', 'desc')->get();
|
||
|
@endphp
|
||
|
|
||
|
<ul>
|
||
|
@foreach ($games as $game)
|
||
|
<li><a href="{{ route('admin.game.edit', $game->id) }}">{{ $game->id }} - {{ $game->name }} ({{ $game->platform()->get()[0]->name }})</a></li>
|
||
|
@endforeach
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!--end::Col-->
|
||
|
</div>
|
||
|
<!--end::Row-->
|
||
|
</x-base-layout>
|