Show count of pending pilot registrations; pagination

This commit is contained in:
Nabeel Shahzad
2017-12-22 14:48:15 -06:00
parent 7103278bb8
commit 50ede116ca
9 changed files with 70 additions and 52 deletions

View File

@@ -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;
}
}