當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。