The blog

Laravel 5: Dispatching Queued Jobs With dispatch

Apr 14, 2018

Learn how to use the dispatch helper function in Laravel to push a new job onto the job queue. This function returns a new instance of "\\Illuminate\\Foundation\\Bus\\PendingDispatch", which allows you to modify properties about the pending job operation, such as its priority level. Find examples of how to use the dispatch function, including alternative methods for invoking it. Plus, discover how to make adjustments to a job's properties before it is added to the job queue.
Laravel 5: Encrypting Strings With encrypt

Apr 14, 2018

The encrypt helper function encrypts a given string value by calling the encrypt method on the Encrypter instance resolved from the Service Container. You can use the encrypt function directly or through the Crypt facade. Alternatively, you can retrieve an instance from the Service Container and call the encrypt method on it.
Laravel 5: Generating an HTML Field for HTTP Verbs With method_field

Apr 14, 2018

The method_field helper function in Laravel is used to generate a hidden HTML input field with the name _method and a specified value. This function returns a new instance of Illuminate\Support\HtmlString. You can use this function to generate HTML input fields for various HTTP methods such as PUT, POST, GET, PATCH, and DELETE. For example, calling method_field('PUT') will generate . Similarly, calling method_field('POST') will generate .
Laravel 5: Generating CSRF Hidden HTML Fields With csrf_field

Apr 14, 2018

The csrf_field function generates a hidden HTML element containing the CSRF token value, which can help prevent cross-site request forgeries. It simplifies the process of including the token in your forms, reducing the need for manual HTML input elements. The function can be used in plain PHP or with Blade syntax in Laravel.
Laravel 5: Generating CSRF Session Tokens With csrf_token

Apr 14, 2018

Learn about the csrf_token function in Laravel, which retrieves the CSRF token from the session storage. The CSRF token is a random string 40 characters long, generated using the str_random(40) function call. You can use the csrf_token function to generate the token and include it in your HTML forms using the csrf_field method, making your forms secure against cross-site request forgery attacks.
Laravel 5: Generating HTTPS URLs With secure_url

Apr 14, 2018

The secure_url helper function generates secure, fully qualified URLs to a given path in Laravel. It can also add additional data as a query string by supplying parameters. Internally, secure_url returns the value of the url helper function. An example use of secure_url is demonstrated, with the resulting URL being dependent on the path and domain name. To generate URLs with extra data, parameters can be supplied in an array.
Laravel 5: Generating Paths Relative to the Application Installation Directory With base_path

Apr 14, 2018

Learn how to use the base_path function in Laravel to retrieve the path to the application's directory and construct relative paths. Check out examples that demonstrate its usage and understand how it differs from the app_path function.
Laravel 5: Generating Paths Relative to the Application Root With app_path

Apr 14, 2018

The app_path function in Laravel returns the full path to the application directory. The value returned depends on your specific folder structure. You can also use app_path to build paths relative to the application directory by supplying a string as the argument. However, keep in mind that the function does not automatically add a trailing forward slash to the returned path, so you may need to use the str_finish function to ensure it is present.
Laravel 5: Generating Paths Relative to the Configuration Directory With config_path

Apr 14, 2018

The config_path function in Laravel retrieves the path to the config directory and can also be used to construct paths relative to the configuration directory. By providing a $path, you can easily generate paths to specific configuration files. For example, calling config_path('database.php') will return the full path to the database.php configuration file in the Laravel application.
Laravel 5: Generating Paths Relative to the Database Directory With database_path

Apr 14, 2018

The database_path function in Laravel can be used to retrieve the directory path of the database. It can also construct paths relative to the database directory by supplying a parameter. For example, calling database_path('migrations') will return the path to the migrations directory in the Laravel application.
Laravel 5: Generating Paths Relative to the Public Directory With public_path

Apr 14, 2018

Learn how to use the public_path function in Laravel to get the path to the public directory or construct relative paths. The function takes an optional path parameter and does not automatically add a trailing slash to the returned string. Find out how to add the trailing slash using the str_finish function.
Laravel 5: Generating Paths Relative to the Resource Directory With resource_path

Apr 14, 2018

The resource_path helper function in Laravel can be used to resolve the path to the resource directory, or to a sub-directory or file within the resources directory. It does not append the trailing forward slash, but you can use the str_finish function to add it if needed.
Laravel 5: Generating Paths Relative to the Storage Directory With storage_path

Apr 14, 2018

Learn how to utilize the storage_path function in Laravel to get the path to the storage directory or construct relative paths. See code examples for different use cases and how to add a trailing slash to the returned path.
Laravel 5: Generating Public URLs to Elixir Compiled Assets With elixir

Apr 14, 2018

Learn how to use the elixir helper function in Laravel 5.4 to get the path to a versioned Elixir file. By default, the function looks in the build directory, which is relative to the public directory. However, you can also specify a custom build directory. In Laravel 5.4, Laravel Elixir was renamed to Laravel Mix, so be sure to use the mix helper function instead.

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.