add recent() call to BaseRepository
This commit is contained in:
@@ -11,9 +11,15 @@ class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
public function view($template, $vars=[])
|
||||
/**
|
||||
* Display a view but pull it from the active skin
|
||||
* @param string $template
|
||||
* @param array $vars
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function view(string $template, array $vars=[])
|
||||
{
|
||||
$tpl = 'layouts/'.config('phpvms.skin').'/'.$template;
|
||||
$tpl = 'layouts/' . config('phpvms.skin') . '/' . $template;
|
||||
return view($tpl, $vars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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