car = $car; $this->brand = $brand; $this->car_model = $car_model; } /** * Returns count of car. * * @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.car.gadget', $count = 10) { if (User::hasRole('user')) { $this->car->pushCriteria(new \Litepie\Autos\Repositories\Criteria\CarUserCriteria()); } $car = $this->car->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('car::' . $view, compact('car'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.brand.gadget', $count = 10) { if (User::hasRole('user')) { $this->brand->pushCriteria(new \Litepie\Autos\Repositories\Criteria\BrandUserCriteria()); } $brand = $this->brand->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('car::' . $view, compact('brand'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.car_model.gadget', $count = 10) { if (User::hasRole('user')) { $this->car_model->pushCriteria(new \Litepie\Autos\Repositories\Criteria\CarModelUserCriteria()); } $car_model = $this->car_model->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('car::' . $view, compact('car_model'))->render(); } }