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


PHP Post::paginate方法代码示例

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


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

示例1: index

 public function index()
 {
     $page_title = 'This is HomePage';
     $posts = Post::latest('published_at')->published()->get();
     $posts = Post::paginate(5);
     //dd($posts);
     return view('posts.index', compact('page_title', 'posts'));
 }
开发者ID:shawon922,项目名称:blog,代码行数:8,代码来源:PostsController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::get('filter')) {
         $records = Post::where('title', 'LIKE', '%' . Request::get('filter') . '%')->paginate(10);
     } else {
         $records = Post::paginate(10);
     }
     return view('back::scope.blog.posts.index', compact('records'));
 }
开发者ID:rdehnhardt,项目名称:rdehnhardt,代码行数:14,代码来源:PostsController.php

示例3: getIndex

    /**
     * Show the profile for the given user.
     *
     * @param  int  $id
     * @return Response
     */
    public function getIndex()
    {

        return view('home')
            ->with('posts', Post::paginate(10))
            ->with('title', 'Blog | Home')
            ->with('description','This is the Home Page Blog')
            ->with('category', Category::all());
    }
开发者ID:rostiknaz,项目名称:laravelblog,代码行数:15,代码来源:HomeController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $limit = Input::get('limit') ?: 5;
     if ($limit > 15) {
         return $this->respondLimitNotAllowed('You are not allowed to fetch more than 15 posts per page.');
     }
     $posts = Post::paginate($limit);
     return $this->respondWithPagination($posts, ['data' => $this->postTransformer->transformCollection($posts->all())]);
 }
开发者ID:neshikj,项目名称:Bloggy,代码行数:14,代码来源:ApiPostsController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $search = '';
     if ($search = $request->input('search')) {
         $posts = Post::where('title', "LIKE", "%" . $search . "%")->orWhere('body', "LIKE", "%" . $search . "%")->paginate(10);
     } else {
         $posts = Post::paginate(10);
     }
     return view('posts.index', compact('posts', 'search'));
 }
开发者ID:alnutile,项目名称:blog_series,代码行数:15,代码来源:PostController.php

示例6: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $user = \Auth::user();
     $posts = \App\Post::all();
     $posts = \App\Post::paginate(3);
     $users = \App\User::all();
     $users = \App\User::paginate(3);
     $fiches = \App\Fiche::all();
     if ($user->role == "teacher") {
         $fiches = \App\Fiche::paginate(3);
     }
     if ($user->role == "teacher") {
         return view('back.index', compact('posts', 'users', 'fiches', 'user'));
     } else {
         return view('backStudent.index', compact('fiches', 'user'));
     }
 }
开发者ID:Vever,项目名称:projetLycee2015,代码行数:22,代码来源:BackController.php

示例7: index

 public function index()
 {
     $posts = Post::paginate();
     return view('posts/list', compact('posts'));
 }
开发者ID:reiniersb87,项目名称:authorization-demo,代码行数:5,代码来源:PostController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //        $posts = Post::all();
     $posts = Post::paginate(env('PAGINATION_MAX'));
     return view('backend.posts.index', compact('posts'));
 }
开发者ID:petrovitch,项目名称:chess,代码行数:11,代码来源:PostsController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Post::paginate(20);
     $section = Section::where('service_id', '1')->where('status', 1)->orderBy('sort_id')->get();
     return view('admin.posts.index', compact('posts', 'section'));
 }
开发者ID:vizovteam,项目名称:vizov,代码行数:11,代码来源:AdminPostsController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = \App\Post::paginate(10);
     return view('posts.index', compact('posts'));
 }
开发者ID:rawaludin,项目名称:laravel5-blog-ciast,代码行数:10,代码来源:PostsController.php

示例11: manage

 public function manage()
 {
     $items_per_page = 10;
     $data['posts'] = App\Post::paginate($items_per_page);
     return view('blog/manage', $data);
 }
开发者ID:xenodus,项目名称:lco_proj,代码行数:6,代码来源:BlogController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts = $this->post->paginate(10);
     return view('admin.posts.index', compact('posts'));
 }
开发者ID:ao-lab,项目名称:laravel-blog,代码行数:10,代码来源:PostsController.php

示例13: desktop

 public function desktop()
 {
     $post = Post::paginate(5);
     return view('desktop', compact('post'));
 }
开发者ID:guillospy92,项目名称:blogs,代码行数:5,代码来源:AdminController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = Post::paginate(5);
     $data = ['posts' => $posts];
     return view('adminpage.post.post', $data);
 }
开发者ID:rulzi,项目名称:larablog,代码行数:11,代码来源:adminPostController.php

示例15: get

 public function get()
 {
     $posts = Post::paginate(env('PAGINATION_MAX'));
     return $posts;
 }
开发者ID:petrovitch,项目名称:chess,代码行数:5,代码来源:BlogController.php


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