本文整理汇总了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'));
}
示例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'));
}
示例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());
}
示例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())]);
}
示例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'));
}
示例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'));
}
}
示例7: index
public function index()
{
$posts = Post::paginate();
return view('posts/list', compact('posts'));
}
示例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'));
}
示例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'));
}
示例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'));
}
示例11: manage
public function manage()
{
$items_per_page = 10;
$data['posts'] = App\Post::paginate($items_per_page);
return view('blog/manage', $data);
}
示例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'));
}
示例13: desktop
public function desktop()
{
$post = Post::paginate(5);
return view('desktop', compact('post'));
}
示例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);
}
示例15: get
public function get()
{
$posts = Post::paginate(env('PAGINATION_MAX'));
return $posts;
}