Showing 10 of 2,055 results.

Example Use | Laravel 5.5 String Helper Method: finish

1 use Illuminate \ Support \ Str ; 2 3 // /home/path/ 4 echo Str :: finish ( ' /home/path ' , ' / ' ) ; 5 6 // /home/path/ 7 echo Str :: finish ( ' /home/path/ ' , ' / ' ) ; 8 9 // Sentences should end with a period, or full stop. 10 echo Str ::...

Creating Our Modifier | Creating a Statamic Compact Modifier

…n. To get started, we will use Statamic's please utility to help us scaffold the code. From the root of your project, issue the following command to generate a new modifier class: 1 php please make:modifier Compact Once the command has executed...

Laravel Collection Public API: except

except($keys) The except method will return all the key/value pairs in the collection where the keys in the collection are not in the supplied $keys array. Internally, this method makes a call to the Illuminate\Support\Arr:except($array, $keys)...

Laravel Artisan Tinker: The clear-compiled Command

The clear-compiled command is used to clear the compiled classes and services application cache. These two files are located in the bootstrap/cache/ directory. The compiled classes cache is stored in a file named compiled.php and the services...

Laravel Classes That Support Macros

The following table will list every framework class that implements the __call method directly. The table will also indicate if the class supports macros even though it implements __call . Please note that the following table does not take into...

Laravel Artisan Generator Command: The make:middleware Command

The make:middleware command is used to generate a middleware class. It accepts a name that will be used as the name of the newly generated class and file. Generated classes are stored within the app/Http/Middleware directory. The following example...

Laravel 5 Macros: Creating Class Based Macros with Mixins

In version 5.4, Laravel added the concept of "macro mixins": a way to define and group related macro methods and utility functions into a class and then inject, or mix in all of the class methods as macro methods to any class that utilizes the...

Laravel Collection Public API: put

put($key, $value) The put method is used to add a new item to the collection with a given $key and $value . The put method modifies the original Collection instance and returns a reference to it. The following code example will highlight the usage...

Laravel Artisan Queue Command: The queue:failed Command

The queue:failed command is a simple command that will list all of the queue jobs that have failed. The data for the generated table comes from the failed_jobs database table. This command defines no parameters or options and can be used like so:...

Laravel MessageBag Public API: add

add($key, $message) The add method adds a new message to the MessageBag instance. The message is identified by a given $key and contains the value $message . The add method returns a reference to the current MessageBag instance. The following code...