Showing 10 of 2,133 results.

Laravel Collection Public API: average

average($key = null) The average method is simply an alias of the avg (discussed in the Laravel Collection Public API: avg article) method, and can be used in exactly the same way to calculate the averages of items within a collection. 1 <?php 2 3...

Laravel MessageBag Public API: getMessages

…ssageBag ; 4 5 // Create a new MessageBag instance. 6 $ messageBag = new MessageBag ; 7 8 // Add new messages to the message bag. 9 $ messageBag -> add ( ' hello ' , ' The first message bag message ' ) ; 10 $ messageBag -> add ( ' world ' , ' The...

Laravel Application Helper: policy

policy($class) The policy helper function can be used to retrieve a policy (a policy class can be any valid PHP class) instance for a given $class . The $class can be either a string or an object instance. If no policies for the given $class have...

Laravel Array Helper Function: array_add

The add helper method adds the given $key and $value to an $array if the $key doesn't already exist within the given $array . The signature for the add helper method is: add($array, $key, $value) Consider the following code snippet: 1 use...

Disabling Core Directives | The Document Parser

Depending on the integration or use case, it may be beneficial to remove support for the core directives and specify only a subset of directives names. We can accomplish this by calling the withoutCoreDirectives method: 1 <?php 2 3 use Stillat \...

Laravel String Helper Function: singular

…he singular form of that word. The internal mechanisms are similar to the plural method. The signature for the singular helper method is: singular($value) 1 use Illuminate \ Support \ Str ; 2 3 // cow 4 echo Str :: singular ( ' cows ' ) ; 5 6 //...

findDirectivesByName | Querying Document Nodes

Returns all directives with the provided name in the source document. Argument Description $name The directive name to search 1 <?php 2 3 use Stillat \ BladeParser \ Nodes \ NodeCollection ; 4 5 public function findDirectivesByName ( 6 string $...

Previous Link | General Metadata

…"prev" href="..."> tag. By default it binds to the $meta_link_prev variable. 1 <?php 2 3 use Stillat \ StatamicSiteEssentials \ Support \ Facades \ Metadata ; 4 5 // Adjusting the returned variable. 6 Metadata :: resolve ( ' meta_link_prev ' ,...