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