public function list($limit = 20, $page = 1) { if ($limit >= 61) { return \Response::json(["status" => "400", "message" => "limitは60以内で指定してください。"]); } $votes = Category::select('id', 'name', 'created_at', 'updated_at')->take($limit)->offset($limit * ($page - 1))->orderBy("name", "asc")->get(); return \Response::json($votes); }
public function getCategoryAttribute() { $category = Category::select('id', 'name', 'pid')->find($this->category_id); if ($category == null) { return ''; } return $category->toArray(); }
public static function getCatFieldData($catId = false) { $data = self::getSortModel(Category::select('id', 'cate_name', 'parent_id')->get()); foreach ($data as $k => $v) { self::$catData[$v->id] = $v->html . $v->cate_name; } if ($catId) { unset(self::$catData[$catId]); } unset($category); return self::$catData; }
public function showAdd() { $getData = Category::select('id', 'category_name', 'as_name', 'parent_id')->get()->toArray(); $list = tree($getData); return view('admin.category.addCategory')->with(array('list' => $list)); }
public function showAdd() { $getData = Category::select('id', 'category_name', 'as_name', 'parent_id')->get()->toArray(); $categoryList = tree($getData); return view('admin.article.editArticle')->with(array('categoryList' => $categoryList)); }