How-to articles, tricks, and solutions about LARAVEL-5

Access denied for user 'homestead'@'localhost' (using password: YES)

This error message indicates that there was a problem connecting to the MySQL database with the provided credentials.

artisan migration error "Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found"

This error message is indicating that the PHP extension for PDO MySQL is not installed or not enabled on your system.

Change Timezone in Lumen or Laravel 5

In Laravel or Lumen, you can set the timezone for your application by setting the timezone option in your config/app.php configuration file.

Fatal error: Class 'Illuminate\Foundation\Application' not found

This error message indicates that the Laravel framework is unable to find the Application class from the Illuminate\Foundation namespace.

Find last iteration of foreach loop in laravel blade

In Laravel Blade, you can use the @forelse loop to check if the last iteration of a loop has been reached.

Format Timezone for Carbon Date

To format a timezone for a Carbon date in PHP, you can use the format() method and include the e or I format codes.

Get environment value in controller

To get an environment value in a PHP controller, you can use the getenv function.

How to delete multiple records using Laravel Eloquent

You can use the destroy() method in Laravel Eloquent to delete multiple records.

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 include External CSS and JS file in Laravel 5

To include external CSS and JavaScript files in a Laravel 5 application, you can use the asset helper function.

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.

laravel - get parameters from http request

In Laravel, you can use the $request object to access parameters from an HTTP request.

Laravel 5 - Interface is not instantiable

This error message in Laravel 5 typically means that you are trying to instantiate an interface, but interfaces cannot be instantiated because they are only a contract for the methods that a class should implement.

Laravel 5 – Clear Cache in Shared Hosting Server

To clear the cache in Laravel 5, you can use the php artisan cache:clear command.

Laravel 5 change public_path()

In Laravel 5, you can change the value of the public_path() function by modifying the 'public' key in the config/filesystems.php configuration file.

Laravel 5 Clear Views Cache

To clear the cache for your views in Laravel 5, you can use the view:clear Artisan command.

Laravel 5 getting ID from URL

In Laravel 5, you can get the ID from the URL by using the $request object or by defining a route parameter in the web.php file.

Laravel 5.3 multiple file uploads

In Laravel 5.3, you can use the Request object's file method to handle multiple file uploads.

Laravel Carbon: how to change timezone without changing the hour?

In Laravel, you can use the setTimezone method on a Carbon instance to change the timezone without changing the hour.

Laravel Check If Related Model Exists

In Laravel, you can use the exists method on a relationship to check if it has any related models.

Laravel Socialite: InvalidStateException

The InvalidStateException is thrown by Laravel's Socialite package when the state parameter provided in the OAuth redirect URL does not match the one stored in the session.

php artisan migrate - SQLSTATE[HY000] [1045] Access denied for user 'laravel'@'localhost'

This error message is indicating that the PHP script, "artisan," is attempting to run a database migration command, but the database server is denying access to the user "laravel" on the "localhost" location.

1 2