Show count of pending pilot registrations; pagination
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Enums\PilotState;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Traits\CacheableRepository;
|
||||
use Prettus\Repository\Contracts\CacheableInterface;
|
||||
@@ -14,10 +15,25 @@ class UserRepository extends BaseRepository implements CacheableInterface
|
||||
'email' => 'like',
|
||||
'home_airport_id',
|
||||
'curr_airport_id',
|
||||
'state'
|
||||
];
|
||||
|
||||
public function model()
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of PIREPs that are pending
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPendingCount()
|
||||
{
|
||||
$where = [
|
||||
'state' => PilotState::PENDING,
|
||||
];
|
||||
|
||||
$users = $this->orderBy('created_at', 'desc')->findWhere($where)->count();
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user