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