Showing 10 of 1,280 results.

Laravel 5: Accessing the Authentication Manager With auth

The auth helper function is a convenience function to quickly access the Laravel authentication features; used without supplying any arguments for $guard , the auth helper function is an alternative to using the Auth facade. With no arguments, the...

Laravel 5 String Helpers: Parse Callback

parseCallback is a fairly simple method, even though it serves a somewhat specialized purpose. The following syntax for class names and method names can be found utilized throughout the Laravel framework: 1 ClassName @ someMethodName The point is...

Laravel String Helper Function: ucfirst

…he ucfirst helper method is used to uppercase the first letter of a string. It defines only one parameter— $string —which is the string that should have its first letter upper cased. This helper method differs from PHP's ucfirst function because...

Laravel 5: Getting the First Element of an Array With head

…d ' 5 ] ; We can get the first element of the array (without removing it) like so: 1 $ firstElement = head ( $ sampleArray ) ; The value of $firstElement would then be first . Additionally, the following function calls are equivalent: 1 // Using...

Laravel Artisan General Command: The optimize Command

The optimize command optimizes various aspects to improve the performance of the Laravel application. The command provides two flags. The --force flag can be set to indicate that the compiled class file should be written (by default the compiled...

Laravel Application Helper Function: request

…elper function, we can access only a subset of the user's input data: 1 <?php 2 3 // Get only the user's name. 4 $ name = request ( ) -> only ( ' name ' ) ; Receiving a subset of data can also be accomplished using the shorthand syntax introduced...

Laravel Collection Public API: max

…in the value 5 . The following code example shows how to use the max function when specifying a $key : 1 <?php 2 3 use Illuminate \ Support \ Collection ; 4 5 // Create a new collection instance. 6 $ collection = new Collection ( [ 7 [ ' name '...

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 Array Helper Function: array_last

last($array, callable $callback = null, $default = null) The last helper method is the logical opposite of the first (discussed in the article Laravel Array Helper Function: array_first method. The difference is that the last function will return...

Laravel Application Helper: response

…ting\ResponseFactory ). The following example demonstrates some of the different methods that are available when the response function is used in this way: 1 <?php 2 3 return response ( ) -> view ( ' welcome ' ) ; 4 return response ( ) -> json (...

Filter Search