Going to start working on friends, almost done with the catalog.
This commit is contained in:
parent
a4f5c0c5d7
commit
8e0a66247d
|
|
@ -8,4 +8,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
class AssetVersion extends Model
|
class AssetVersion extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
public function asset()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Asset::class, 'parentAsset');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use App\Notifications\ResetPasswordNotification;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
use App\Notifications\ResetPasswordNotification;
|
||||||
|
use App\Models\Friend;
|
||||||
|
|
||||||
class User extends Authenticatable implements MustVerifyEmail
|
class User extends Authenticatable implements MustVerifyEmail
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
@ -56,4 +59,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
|
|
||||||
$this->notify(new ResetPasswordNotification($url, $this));
|
$this->notify(new ResetPasswordNotification($url, $this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFriendRequests()
|
||||||
|
{
|
||||||
|
return Friend::where('receiver_id', Auth::user()->id)
|
||||||
|
->where('accepted', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ class Asset extends Model
|
||||||
public function getContent($version = 0)
|
public function getContent($version = 0)
|
||||||
{
|
{
|
||||||
if($version === 0)
|
if($version === 0)
|
||||||
return $this->latestVersion()->contentURL;
|
return $this->latestVersion->contentURL;
|
||||||
|
|
||||||
$assetVersion = AssetVersion::where('parentAsset', $this->id)
|
$assetVersion = AssetVersion::where('parentAsset', $this->id)
|
||||||
->where('localVersion', $version)
|
->where('localVersion', $version)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class Comments extends Component {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h4 className="pt-3">Comments</h4>
|
<h4 className="pt-3">Comments</h4>
|
||||||
|
{ /* TODO: XlXi: Hide comment input when logged out*/ }
|
||||||
<div className="card mb-2">
|
<div className="card mb-2">
|
||||||
<div className="input-group p-2">
|
<div className="input-group p-2">
|
||||||
<input disabled="disabled" type="text" className="form-control" placeholder="Write a comment!" />
|
<input disabled="disabled" type="text" className="form-control" placeholder="Write a comment!" />
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
@php
|
@php
|
||||||
// TODO: load from website configuration?
|
// TODO: XlXi: load from website configuration?
|
||||||
$routes = [
|
|
||||||
|
$routes = [
|
||||||
[
|
[
|
||||||
"label" => "Games",
|
"label" => "Games",
|
||||||
"location" => "games"
|
"location" => "games"
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
"label" => "Forum",
|
"label" => "Forum",
|
||||||
"location" => "forum"
|
"location" => "forum"
|
||||||
]
|
]
|
||||||
]
|
];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="navbar graphictoria-navbar fixed-top navbar-expand-md shadow-sm">
|
<div class="navbar graphictoria-navbar fixed-top navbar-expand-md shadow-sm">
|
||||||
|
|
@ -39,7 +40,6 @@
|
||||||
@live
|
@live
|
||||||
@foreach($routes as $route)
|
@foreach($routes as $route)
|
||||||
@php
|
@php
|
||||||
// HACK
|
|
||||||
$route = (object)$route;
|
$route = (object)$route;
|
||||||
@endphp
|
@endphp
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
@ -49,8 +49,14 @@
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="graphictoria-nav-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">More</a>
|
<a class="nav-link dropdown-toggle" href="#" id="graphictoria-nav-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">More</a>
|
||||||
<ul class="dropdown-menu graphictoria-nav-dropdown" area-labelledby="graphictoria-nav-dropdown">
|
<ul class="dropdown-menu graphictoria-nav-dropdown" area-labelledby="graphictoria-nav-dropdown">
|
||||||
|
@auth
|
||||||
|
<li><a @class(['dropdown-item', 'active'=>str_starts_with(Request::path(), 'my/create')]) href="{{ url('/my/create') }}">Create</a></li>
|
||||||
|
@endauth
|
||||||
|
<li><a @class(['dropdown-item', 'active'=>str_starts_with(Request::path(), 'groups')]) href="{{ url('/groups') }}">Groups</a></li>
|
||||||
<li><a @class(['dropdown-item', 'active'=>str_starts_with(Request::path(), 'users')]) href="{{ url('/users') }}">Users</a></li>
|
<li><a @class(['dropdown-item', 'active'=>str_starts_with(Request::path(), 'users')]) href="{{ url('/users') }}">Users</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
<li><a class="dropdown-item" href="https://discord.gg/q666a2sF6d" target="_blank" rel="noreferrer">Discord</a></li>
|
<li><a class="dropdown-item" href="https://discord.gg/q666a2sF6d" target="_blank" rel="noreferrer">Discord</a></li>
|
||||||
|
<li><a class="dropdown-item" href="https://blog.gtoria.net" target="_blank" rel="noreferrer">Blog</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@else
|
@else
|
||||||
|
|
@ -62,22 +68,43 @@
|
||||||
@live
|
@live
|
||||||
@auth
|
@auth
|
||||||
<div id="graphictoria-nav-searchbar" class="graphictoria-search"></div>
|
<div id="graphictoria-nav-searchbar" class="graphictoria-search"></div>
|
||||||
<div class="flex">
|
<ul class="navbar-nav ms-auto me-2">
|
||||||
|
<li class="nav-item">
|
||||||
|
{{-- TODO: XlXi: messages and notifications --}}
|
||||||
|
<a @class(['nav-link', 'active'=>str_starts_with(Request::path(), 'my/friends')]) href="{{ url('/my/friends') }}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Friends">
|
||||||
|
@php
|
||||||
|
$friendRequestCount = Auth::user()->getFriendRequests()->count();
|
||||||
|
@endphp
|
||||||
|
@if($friendRequestCount > 0)
|
||||||
|
<span class="position-relative top-0 start-100 translate-middle badge rounded-pill bg-danger">
|
||||||
|
{{
|
||||||
|
$friendRequestCount > 99 ? '99+' : $friendRequestCount
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
<i class="fa-solid fa-user-group"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="d-md-flex">
|
||||||
<p class="my-auto me-2 text-muted" style="color:#e59800!important;font-weight:bold">
|
<p class="my-auto me-2 text-muted" style="color:#e59800!important;font-weight:bold">
|
||||||
<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="You have {{ number_format(Auth::user()->tokens) }} tokens. Your next reward is in {{ Auth::user()->next_reward->diffForHumans(['syntax' => Carbon\CarbonInterface::DIFF_ABSOLUTE]) }}.">
|
<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="You have {{ number_format(Auth::user()->tokens) }} tokens. Your next reward is in {{ Auth::user()->next_reward->diffForHumans(['syntax' => Carbon\CarbonInterface::DIFF_ABSOLUTE]) }}.">
|
||||||
<img src="{{ asset('images/symbols/token.svg') }}" height="20" width="20" class="img-fluid me-1" style="margin-top:-1px" />{{ \App\Helpers\NumberHelper::Abbreviate(Auth::user()->tokens) }}
|
<img src="{{ asset('images/symbols/token.svg') }}" height="20" width="20" class="img-fluid me-1" style="margin-top:-1px" />{{ \App\Helpers\NumberHelper::Abbreviate(Auth::user()->tokens) }}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<a class="nav-link dropdown-toggle graphictoria-user-dropdown" href="#" id="graphictoria-user-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">
|
<a class="nav-link dropdown-toggle graphictoria-user-dropdown px-0 px-md-3" href="#" id="graphictoria-user-dropdown" role="button" data-bs-toggle="dropdown" area-expanded="false">
|
||||||
<span class="d-flex align-items-center">
|
<span class="d-flex align-items-center">
|
||||||
<img src="{{ asset('images/testing/headshot.png') }}" class="img-fluid border me-1 graphictora-user-circle" width="37" height="37">
|
<img src="{{ asset('images/testing/headshot.png') }}" class="img-fluid border me-1 graphictora-user-circle" width="37" height="37">
|
||||||
<p>{{ Auth::user()->username }}</p>
|
<p>{{ Auth::user()->username }}</p>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu graphictoria-user-dropdown" area-labelledby="graphictoria-user-dropdown">
|
<ul class="dropdown-menu graphictoria-user-dropdown" area-labelledby="graphictoria-user-dropdown">
|
||||||
|
<li><a class="dropdown-item" href="{{ url('/todo123') }}">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="{{ url('/todo123') }}">Character</a></li>
|
||||||
<li><a class="dropdown-item" href="{{ url('/my/settings') }}">Settings</a></li>
|
<li><a class="dropdown-item" href="{{ url('/my/settings') }}">Settings</a></li>
|
||||||
<li><a class="dropdown-item" href="{{ url('/logout') }}">Logout</a></li>
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="{{ url('/logout') }}">Sign out</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue