本文整理汇总了PHP中app\models\Category::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::get方法的具体用法?PHP Category::get怎么用?PHP Category::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Category
的用法示例。
在下文中一共展示了Category::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//获取商品类型
$type_list = Type::all();
//获取商品分类
$categoryData = Category::get();
$cate_list = getTree($categoryData);
return view('admin.goods.create', compact('type_list', 'cate_list'));
}
示例2: edit
/**
* edit data page
* @param int id
* @return view
*/
public function edit($id)
{
$categoryData = Category::get();
$ids = getChild($categoryData, $id);
$ids[] = $id;
$category = getTree($categoryData);
$info = Category::findOrFail($id);
return view('admin.category.edit', compact('ids', 'category', 'info'));
}
示例3: sidebarCategory
protected function sidebarCategory()
{
if (!Cache::has('_tags')) {
$tags = Tagged::join('tags', 'tagged.tag_id', '=', 'tags.id')->select('tags.id', DB::raw('count(tag_id) as total_tags'), 'tags.tag_name')->groupBy('tagged.tag_id')->take(20)->get();
Cache::put('_tags', $tags, 60);
}
if (!Cache::has('_category')) {
$category = Category::get();
Cache::put('_category', $category, 60);
}
if (!Cache::has('_recent')) {
$recent = Diary::where('status', 1)->orderBy('created_at', 'desc')->take(5)->get(['title', 'id']);
Cache::put('_recent', $recent, 60);
}
view()->composer('site.partials.sidebar', function ($view) {
$view->with('navData', ['category' => Cache::get('_category'), 'recents' => Cache::get('_recent'), 'tags' => Cache::get('_tags')]);
});
}
示例4: create
public function create()
{
$categories = Category::get()->lists('title', 'id');
return view('news.create', ['categories' => $categories]);
}
示例5: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return Category::get();
}
示例6: category
public function category($category)
{
$category = models\Category::get($category);
$messages = Session::messages();
return $this->tpl->display(__METHOD__, get_defined_vars());
}
示例7: getEdit
public function getEdit($id)
{
$cat = Category::get();
$diary = Diary::find($id);
return view('admin.diary.editdiary', ['pageInfo' => ['siteTitle' => 'Edit Diary', 'pageHeading' => 'Edit Diary', 'pageHeadingSlogan' => 'I write here what I learn'], 'data' => ['category' => $cat, 'diary' => $diary]]);
}
示例8: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data = Category::get();
return response()->json($data);
}
示例9: listCategory
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function listCategory()
{
return view('admin.partials.list_category', ['categories' => Category::get()]);
}