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