本文整理汇总了PHP中app\Category::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::paginate方法的具体用法?PHP Category::paginate怎么用?PHP Category::paginate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Category
的用法示例。
在下文中一共展示了Category::paginate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$categories = Category::paginate();
$categories->setPath(route('categories.index'));
//dd($categories);
return view("categories.lista", compact('categories'));
}
示例2: categories
public function categories()
{
$view = Input::get('view');
if ($view == null) {
return redirect('/admin/categories?view=hierarchy');
}
$levels = ['Main Category', 'Subcategory', 'Post Sub Category'];
$types = ['main-categories', 'sub-categories', 'post-sub-categories'];
$views = ['Hierarchy', 'Type', 'All'];
$cats = Category::roots()->get();
$category = Input::get('category');
$_category = Category::find($category);
if ($view == 'type') {
$type = Input::get('type');
if ($type == null) {
$type = $types[0];
}
// array_keys() = get keys from value
// appends() = add 'get' variables (to url)
$cats = Category::whereDepth(array_keys($types, $type))->paginate(25)->appends(Input::except('page'));
} else {
if ($view == 'all') {
$cats = Category::paginate(25)->appends(Input::except('page'));
}
}
return view('admin.main')->with('category', $_category)->with('cats', $cats)->with('levels', $levels)->with('view', $view)->with('views', $views)->with('types', $types);
// only for 'type' view
}
示例3: categories
/**
* Show user categories.
* @return Response
*/
public function categories()
{
if ($this->user->categories()->count() > 0) {
$categories = $this->user->categories()->paginate(10);
} else {
$categories = Category::paginate(10);
}
return view('pages.categories', compact('categories'));
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//$categories = Category::orderBy('name')->get();;
$categories = Category::paginate(5);
return view('admin.categories.index', compact('categories'));
//Regresar la variable categories a la vista con todos los datos
// return \View::make('categories.index')
// ->with('categories', Category::all());
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$results = ['columns' => [['编号', 'id'], ['分类名', 'name'], ['创建时间', 'created_at'], ['更新时间', 'updated_at'], ['操作', 'buttons', function ($data) {
$buttons = [['查看'], ['编辑']];
return $buttons;
}]]];
$paginate = Category::paginate();
$results['items'] = $paginate;
return $this->view(self::URI . '.index', compact('results'));
}
示例6: index
public function index()
{
$categories = Category::paginate(5);
return view('admin.category.index', compact('categories'));
}
示例7: category
public function category(Request $request)
{
$category = Category::paginate(15);
return view('admin.category.index', compact('category'));
}
示例8: index
/**
* Display a listing of the resource.
* @param Request $request
* @return Response
* @internal param
*/
public function index(Request $request)
{
$limit = $request->input('limit') ?: 3;
$categories = Category::paginate($limit);
return $this->respondWithPagination($categories, ['data' => $this->categoryTransformer->transformCollection($categories->all())]);
}
示例9: index
public function index()
{
$categories = Category::paginate();
return view('category/category-list')->with('categories', $categories);
}
示例10: categories
public function categories()
{
$categories = Category::paginate(20);
return View('admin.categories', compact('categories'));
}
示例11: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$category = Category::paginate(5);
return view('categories.index', compact('category'));
}
示例12: getIndex
public function getIndex()
{
$categories = Category::paginate(5);
$title = 'Categories Listing';
return view('category.index', compact('categories', 'title'));
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$categories = Category::paginate(15);
return View('admin.categories.category')->with('categories', $categories);
}
示例14: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$category = Category::paginate(20);
return view('category-list')->with('category', $category);
}
示例15: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$categories = Category::paginate(30);
return View('categories.index', compact('categories'));
}