Added account status badges

This commit is contained in:
Miguel Nogueira 2021-10-25 02:28:42 +01:00
parent 3c0e33fef7
commit 1afd420d25
Signed by: miguel456
GPG Key ID: 2CF61B825316C6A0
4 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,31 @@
<?php
namespace App\View\Components;
use App\User;
use Illuminate\View\Component;
class AccountStatus extends Component
{
public $user;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($userId)
{
$this->user = User::findOrFail($userId);
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.account-status');
}
}

View File

@ -0,0 +1,15 @@
<span>
@if ($user->isBanned())
<span class="badge badge-danger"><i class="fa fa-ban"></i> {{__('Suspended')}}</span>
@else
<span class="badge badge-success">{{__('Active')}}</span>
@endif
@if(!is_null($user->email_verified_at))
<span class="badge badge-success"><i class="fas fa-check-square"> </i> {{ __('Verified Email') }}</span>
@else
<span class="badge badge-danger"><i class="fas fa-exclamation-circle"></i> {{ __('Unverified Email') }}</span>
@endif
</span>

View File

@ -131,11 +131,7 @@
<td>{{$user->name}}</td>
<td>{{ $user->email }}</td>
<td>
@if ($user->isBanned())
<span class="badge badge-danger"><i class="fa fa-ban"></i> {{__('messages.players.banned')}}</span>
@else
<span class="badge badge-success">{{__('messages.players.active')}}</span>
@endif
<x-account-status user-id="{{ $user->id }}"></x-account-status>
</td>
<td>{{$user->created_at}}</td>
<td>

View File

@ -68,7 +68,9 @@
@endforeach
</td>
<td>{{ $user->email }}</td>
<td><span class="badge badge-success">{{__('messages.players.active')}}</span></td>
<td>
<x-account-status user-id="{{ $user->id }}"></x-account-status>
</td>
<td>{{$user->created_at}}</td>
<td>
<button type="button" class="btn btn-sm btn-success mr-2" onclick="window.location.href='{{route('showSingleProfile', ['user' => $user->id])}}'"><i class="fa fa-eye"></i></button>