add recent() call to BaseRepository
This commit is contained in:
@@ -2,24 +2,31 @@
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Repositories\PirepRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
|
||||
use App\Models\Pirep;
|
||||
use App\Models\User;
|
||||
|
||||
|
||||
class DashboardController extends AppBaseController
|
||||
{
|
||||
private $pirepRepo, $userRepo;
|
||||
|
||||
public function __construct(
|
||||
PirepRepository $pirepRepo,
|
||||
UserRepository $userRepo
|
||||
) {
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$pireps = Pirep::orderBy('created_at', 'desc')->take(5)->get();
|
||||
$users = User::orderBy('created_at', 'desc')->take(5)->get();
|
||||
$pireps = $this->pirepRepo->recent();
|
||||
$users = $this->userRepo->recent();
|
||||
|
||||
return $this->view('dashboard.index', [
|
||||
'user' => Auth::user(),
|
||||
|
||||
Reference in New Issue
Block a user