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