Answer the question
In order to leave comments, you need to log in
Get item by item_id from LengthAwarePaginator in Laravel 5.3?
Functions:
{{$categories->find($category->parent_id)}}
// и
{{$categories->where('category_id', $category->parent_id)}}
LengthAwarePaginator {#324 ▼
#total: 55
#lastPage: 11
#items: Collection {#325 ▶}
#perPage: "5"
#currentPage: 1
#path: "http://lara53/categories/5"
#query: []
#fragment: null
#pageName: "page"
}
Answer the question
In order to leave comments, you need to log in
The paginator returns a certain number of elements from the database.
If you need to display to search for those elements that are displayed in the paginator, it is enough to use collections.
If you want to get an instance of an object from the entire table, use Eloquent. The paginator's response does not and will not contain all the data from the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question