You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@GrahamCampbell Because view composers don't contain any relation to the context the view is being rendered in.
As I see it, rendering the pagination is akin to including sub-views. They allow extra data to be passed in so that you can e.g. conditionally show HTML/data/etc.
This functionality would be useful in the pagination view so one could e.g. change the arrow character used for the paginaiton next/previous links in different parts of your application. If you currently want to be able to do this, you have to have two almost identical pagination views that are only different by two characters. This is a significant amount of code repetition.
There is also a suggestion of a convention in the framework that when you specify a view name, the next parameter is data to be passed to the view, so to me, this functionality is one of those rare times in Laravel where you expect something to work the way you are used to but doesn't, so this PR increases consistency in that regard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When rendering pagination with a custom view:
{!! $users->links('custom-view') !!}this pull request adds the ability to send data to the view:
{!! $users->links('custom-view', ['foo' => 'bar']) !!}