/** * shortcuts */ public function shortcutsAction() { if ($this->request->isPost()) { $name = $this->request->get('name'); $icon = $this->request->get('icon'); $path = $this->request->get('path'); if (empty($name) || empty($icon) || empty($path)) { return $this->ajaxResponse(1); } $shortcut = new Shortcut(); $shortcut->hash_id = strtoupper(Str::random()); $shortcut->user_id = $this->current_user->id; $shortcut->name = $name; $shortcut->icon = $icon; $shortcut->path = $path; $shortcut->create(); return $this->ajaxResponse(0); } $shortcut = Shortcut::find(["user_id = :user_id:", 'bind' => ['user_id' => $this->current_user->id]]); $this->view->setVar('shortcut', $shortcut); }