How-to articles, tricks, and solutions about LARAVEL

How to Format Laravel Blade Code in Visual Studio Code?

You can use the Laravel Blade Snippets extension for Visual Studio Code to format Blade code in your Laravel projects.

How to get all rows (soft deleted too) from a table in Laravel?

In Laravel, you can use the withTrashed() method to retrieve all the rows, including the soft deleted ones, from a table.

How to get client IP address in Laravel 5+

In Laravel, you can get the client's IP address by using the Request facade's ip method.

How to get Current Timestamp from Carbon in Laravel 5

You can use the now() method from the Carbon class to get the current timestamp in Laravel.

How to get file URL using Storage facade in laravel 5?

To get the URL of a file using the Storage facade in Laravel 5, you can use the url method.

How to get last insert id in Eloquent ORM laravel

In Laravel, you can use the save method provided by Eloquent to insert a new record and retrieve the last insert ID.

How to get the Query Builder to Output its Raw SQL Query as a String with PHP

If you want to grasp the way of getting a query builder to output its raw SQL query as a string using PHP, then you are in the right place.

How to handle Undefined Offset in laravel?

In Laravel, an "Undefined offset" error typically occurs when trying to access an array index that does not exist.

How to install all required PHP extensions for Laravel?

To install all of the required PHP extensions for Laravel, you will need to install the following PHP extensions on your server:

How to install Laravel's Artisan?

To install Laravel's Artisan, you will need to install the Laravel framework on your machine first.

How to install PHP composer inside a docker container

To install PHP Composer inside a Docker container, you will need to do the following:

How to Make Laravel Eloquent "IN" Query?

You can use the whereIn method on a query builder instance to create an "IN" clause for a given column and values.

How to reload/refresh model from database in Laravel?

In Laravel, you can use the refresh method on a model instance to reload the model's attributes from the database.

How to select year and month from the created_at attributes of database table in laravel 5.1?

In Laravel 5.1, you can use the selectRaw method to select the year and month from the created_at attribute of a database table.

How to set and get Cookie in laravel

To set a cookie in Laravel, you can use the Cookie facade.

How to to send mail using gmail in Laravel?

To send email using Gmail in Laravel, you can use the built-in Swift Mailer library.

How to upload files in Laravel directly into public folder?

To upload files directly into the public folder in Laravel, you can use the storeAs method provided by the Storage facade.

How to validate array in Laravel?

In Laravel, you can use the validate method on the Validator facade to validate an array of form data.

How to Validate on Max File Size in Laravel?

To validate a file size in Laravel, you can use the size rule in your request validation.

How to write own DD() function same as laravel?

To create your own version of the Laravel DD() function, you can create a new function in your codebase and have it take in any number of arguments.

How validate unique email out of the user that is updating it in Laravel?

In Laravel, you can use the unique validation rule to validate that an email address is unique when a user is updating their account.

In Laravel is there a way to add values to a request array?

Yes, you can add values to a request array in Laravel by using the merge method on the request object.

Installing specific laravel version with composer create-project

To install a specific version of Laravel using the Composer create-project command, you can specify the version number after the package name.