manufacturer = $manufacturer; $this->car = $car; $this->automodel = $automodel; $this->body = $body; } /** * Returns count of auto. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.manufacturer.gadget', $count = 10) { if (User::hasRole('user')) { $this->manufacturer->pushCriteria(new \Litepie\Lavalite\Repositories\Criteria\ManufacturerUserCriteria()); } $manufacturer = $this->manufacturer->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('auto::' . $view, compact('manufacturer'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.car.gadget', $count = 10) { if (User::hasRole('user')) { $this->car->pushCriteria(new \Litepie\Lavalite\Repositories\Criteria\CarUserCriteria()); } $car = $this->car->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('auto::' . $view, compact('car'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.automodel.gadget', $count = 10) { if (User::hasRole('user')) { $this->automodel->pushCriteria(new \Litepie\Lavalite\Repositories\Criteria\AutomodelUserCriteria()); } $automodel = $this->automodel->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('auto::' . $view, compact('automodel'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.body.gadget', $count = 10) { if (User::hasRole('user')) { $this->body->pushCriteria(new \Litepie\Lavalite\Repositories\Criteria\BodyUserCriteria()); } $body = $this->body->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('auto::' . $view, compact('body'))->render(); } }