Showing 10 of 1,278 results.

Laravel 5 Collections: Retrieving Collection Elements With get

The get method can be used to retrieve an item from the collection based of its $key . An optional $default argument can be passed that will be returned if the supplied $key does not exists in the collection. The $default argument can be a simple...

Laravel Artisan Generator Command: The make:seeder Command

The make:seeder command can be used to generate new seed classes. The command accepts a name argument that will be used as the name of the newly generated file and class. Generated seeder classes are stored in the database/seeds/ directory by...

Laravel Miscellaneous Helper Function: with

with($object) The with function will simply return the supplied $object . This function can be used to invoke methods on new class instances that are passed as function arguments: 1 <?php 2 3 class ExampleClass { 4 5 public function someMethod ( )...

Laravel Artisan Queue Command: The queue:forget Command

The queue:forget command is used to remove a single failed queue job entry from the failed_jobs database table. The command accepts the id of the job to remove as its only argument. The following example demonstrates the usage of the queue:forget...

Laravel 5 Collections: Sorting a Collection With sort

The sort method is used to sort the collection. If no $callback is provided, the collection will be sorted using a case-insensitive "natural order" algorithm. An optional $callback can be supplied to customize the comparison that is used when...

Laravel Array Helper Function: array_first

first($array, callable $callback = null, $default = null) Let's begin discussing the first helper method be examining the $callback . The $callback is a function that accepts a $key and a $value as its parameters. The following code sample is an...

Laravel Artisan Queue Command: The queue:failed-table Command

The queue:failed-table command is used to create a new migration for the failed_jobs database table. This table is in order to keep track of any queue jobs that have failed. This command defines no parameters and can be used like so: 1 php artisan...

Filter Search