Method Paginate Does not exist in laravel 5.5

Haroon Zaqoota
public function index(Tag $tag){

    //$posts=$tag->posts;

    $posts=$tag->posts->paginate(10);

    return view('posts.index' , compact('posts'));
}
Alexey Mezenin

Use relationship, not property:

$tag->posts()->paginate(10);

When you're using property, the query is already executed and you can't use the paginate() method on a collection.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Laravel 5 Paginate + Infinite Scroll jQuery

分類Dev

Infinite Scroll jQuery&Laravel 5 Paginate

分類Dev

Method Illuminate\Database\Eloquent\Collection::paginate does not exist

分類Dev

Laravel - method whereDate does not exist

分類Dev

Method links does not exist in Laravel

分類Dev

MVC 5 does a controller exist

分類Dev

Laravel 2 instances of BadMethodCallException: 'int does not exist' and 'method does not exist'

分類Dev

laravel pagination Method links does not exist

分類Dev

Method [validateA] does not exist in Laravel 5.0

分類Dev

Laravel 5のpaginate()メソッドが機能しない

分類Dev

Laravel5でorderByとPaginateを同時に使用する方法

分類Dev

Using Laravel 5 Method Injection with other Parameters

分類Dev

Angular 5 to 6 Upgrade: Property 'map' does not exist on type Observable

分類Dev

Migrating Hibernate 3 to 5: relation hibernate_sequence does not exist

分類Dev

Migrating Hibernate 3 to 5: relation hibernate_sequence does not exist

分類Dev

Angular 5 : Property 'then' does not exist on type 'Observable<any>'

分類Dev

What does $app['files'] do in Laravel 5

分類Dev

Laravel 5 namespaces

分類Dev

Laravel 5 + MongoDB

分類Dev

Laravel 5 schedule not working

分類Dev

Laravel 5 filter on pivot

分類Dev

VARCHAR max in laravel 5

分類Dev

Laravel 5:出力tFPDF

分類Dev

Laravel 5: Action not defined

分類Dev

url facade in laravel 5

分類Dev

Laravel 5: custom routing

分類Dev

Laravel 5 repository injection

分類Dev

require() not working in Laravel 5

分類Dev

Laravel 5 entrust attachRolle