Showing 7 of 1,975 result(s)
The groupBy method is used to group a collection based on a given value, represented by the $groupBy parameter. An argument passed to $groupBy can be a simple string, representing the value that the collection should be grouped by, or a callback...
The only method is the logical opposite of the except method. The only method is used to return all the key/value pairs in the collection where the keys in the collection are in the supplied $keys array. If the argument supplied for $keys...
The map method applies a given $callback to each item in the collection. The $callback can modify the item which will be added to a new collection. The map method does not modify the original collection, but returns a new collection instance with...
It is often that when working on projects locally, the project is in debug mode. Because of this, we will see screens like this instead of our custom error page: To have our custom error page show up we need to temporarily update our .env file and...
Suppose we wanted to access only the first and last items of an array without looping through all of the items in the list. We can use the first and last modifiers to easily access the data for these items. Consider the following data: Example...
Now that we have the PrettyPaginator class written, we actually need to use it. This will involve some more work, but its pretty simple. Here are the things we will need to do: Create a new Route for our pagination URL,, Create a function that...
We are going to paginate a list of users. We want to display users with the URL format: http://localhost:8000/users/page/{page} . We are going to use a function called getShowResults in our UsersController . We can express this in our routes.php...