当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::paginate方法代码示例

本文整理汇总了PHP中app\models\Post::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::paginate方法的具体用法?PHP Post::paginate怎么用?PHP Post::paginate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Post的用法示例。


在下文中一共展示了Post::paginate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //$posts = Post::all();
     $paginator = Post::paginate(9);
     $posts = $paginator->getCollection();
     $data = fractal()->collection($posts)->transformWith(new PostTransformer())->includeUser()->includeCategories()->paginateWith(new IlluminatePaginatorAdapter($paginator))->toArray();
     return $this->respond($data);
 }
开发者ID:elieandraos,项目名称:project-evey,代码行数:13,代码来源:PostsController.php

示例2: estates

 public function estates(Request $request)
 {
     $posts = Post::paginate($this->posts_per_page);
     if ($request->ajax()) {
         return ['posts' => view('ajax.estates', compact('posts'))->render(), 'next_page' => $posts->nextPageUrl()];
     }
     return view('estates', compact('posts'));
 }
开发者ID:vtlkzmn,项目名称:VeebirakendusteLoomine,代码行数:8,代码来源:PagesController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Post::paginate(Input::get('itemPerPage'));
     foreach ($posts as $post) {
         $post = array_except($post, array("body"));
         $teacher = Teacher::find($post->author_id);
         $category_id = CategoryPost::wherePost_id($post->id)->first()->category_id;
         $category = Category::find($category_id)->name;
         $post['category_id'] = $category_id;
         $post['category'] = $category;
         $post['author'] = $teacher->name;
         $post['fb'] = $teacher->fb;
     }
     return $posts;
 }
开发者ID:rakeen,项目名称:creative,代码行数:20,代码来源:PostsController.php

示例4: getIndex

 public function getIndex(Request $req, $page = 1)
 {
     /*if (Auth::check())
       {
           //dd(Auth::user());
           $user = Auth::user();
           echo $user->id;
           dd(Auth::user());
           exit;
       } else {
           return 'Guest';
       }*/
     $data = Post::paginate(2);
     $data->setPath('post');
     $data->lastPage();
     return view('admins.posts.dashboard', compact('data'));
 }
开发者ID:JoeIMIsu,项目名称:laravel5-project,代码行数:17,代码来源:PostController.php

示例5: index

 public function index()
 {
     $posts = Post::paginate(15);
     return view('posts.list', array('posts' => $posts));
 }
开发者ID:lukasztaras,项目名称:polblog,代码行数:5,代码来源:PostController.php

示例6: index

 public function index()
 {
     $posts = $this->post->paginate(10);
     return view('admin.index', ['posts' => $posts]);
 }
开发者ID:pauloricardo,项目名称:blog-son-laravel,代码行数:5,代码来源:PostsAdminController.php

示例7: index

 public function index()
 {
     $posts = Post::paginate(10);
     return view('home', array('posts' => $posts));
 }
开发者ID:lukasztaras,项目名称:polblog,代码行数:5,代码来源:HomeController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Post::paginate(10);
     //        dd($posts->toArray());
     return view('site.blog.index')->with('posts', $posts);
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:11,代码来源:BlogController.php

示例9: index

 public function index()
 {
     $posts = $this->post->paginate(5);
     return view('home.index', ['posts' => $posts]);
 }
开发者ID:pauloricardo,项目名称:blog-son-laravel,代码行数:5,代码来源:HomeController.php


注:本文中的app\models\Post::paginate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。