What's New in Laravel 8? Powerful New Features & Improvements

What's New in Laravel 8? Powerful New Features & Improvements

Laravel 8 has introduced many new powerful features such as Laravel Jetstream, Job Batching, New Model Directory, and Schema Dump. Many existing features such as Route Caching, Maintenance Mode, Rate Limiting and Bug Fixes were also enhanced. Since the Laravel 8 release, many minor updates have also been released throughout.

Laravel 8 has brought many new flexible and powerful features such as Laravel Jetstream. Many existing features have also been enhanced hugely.

What’s new in Laravel 8? Plenty!

Laravel 8 has introduced many new powerful features such as Laravel Jetstream, Job Batching, New Model Directory, and Schema Dump. Many existing features such as Route Caching, Maintenance Mode, Rate Limiting and Bug Fixes were also enhanced. Since the Laravel 8 release, many minor updates have also been released throughout.

It will provide 6 months of bug fixes and 1-year security fixes from the date of release. While minor and patch releases may be as often as every week.

Let’s go through them together with some of these awesome Laravel features.

New Models Directory in Laravel 8

Prior to Laravel 8, the default Laravel application skeleton had kept its models under the ‘app’ directory. After an overwhelming community demand, it now contains an ‘app/Models’ directory which definitely is a cleaner way to maintain all these models.

Furthermore, all relevant generator commands have also been updated assuming your models exist within the ‘app/Models’ directory if it exists. If the directory does not exist, the framework will simply just keep your models within the ‘app’ directory.

Laravel 8 New Jetstream

Laravel Jetstream is a beautifully designed replacement and improvements upon the legacy authentication UI scaffolding available for the previous versions of Laravel written by Taylor Otwell. This design is using Tailwind CSS and offers your choice of Livewire or Inertia scaffolding.

Laravel Jetstream

It provides many useful functionalities such as login, registration, email verification, two-factor authentication, session management, API support via Laravel Sanctum, and optional team management.

Model Factory Classes

The Eloquent model factories have gone through some major changes. It is now class-based factories as well as improvements to have first-class relationship support.

With the new ‘HasFactory’ trait available on generated models, the model factory can be called upon like this:

use AppModelsUser;
User::factory()->count(50)->create();

Due to the latest model factories written to support classes and is not compatible with Laravel 7.x style factories. However, for people who wants to continue using Laravel 7, there’s a plugin to keep the structure as it is.

Migration Squashing

To prevent your migration directory from becoming overloaded with potentially hundreds of migration. If your application uses MySQL or PostgreSQL, the new Laravel update allows you to ‘squash’ all your migrations into one single SQL file to your ‘database/schema’ directory.

When trying to attempt to migrate your database, Laravel will execute the schema file’s SQL first, then execute any remaining migrations that were not part of the schema dump.

This essentially makes the migration section much cleaner.

Job Batching with Laravel 8

Laravel 8's job batching functionality enables you to efficiently execute a batch of jobs and when the jobs have complete executing it will then perform some action.

Laravel 8’s new ‘batch’ method of the ‘Bus’ facade allows you to use it to dispatch a batch of jobs. Furthermore, it is most useful when combined with completion callbacks such as ‘then’, ‘catch’, and ‘finally’ methods. Every callback will receive an **IlluminateBusBatch** instance when they are invoked.

$batch = Bus::batch([
 new ProcessPodcast(Podcast::find(1)),
 new ProcessPodcast(Podcast::find(2)),
 new ProcessPodcast(Podcast::find(3)),
 new ProcessPodcast(Podcast::find(4)),
 new ProcessPodcast(Podcast::find(5)),
])->then(function (Batch $batch) {
 // All jobs completed successfully...
})->catch(function (Batch $batch, Throwable $e) {
 // First batch job failure detected...
})->finally(function (Batch $batch) {
 // The batch has finished executing...
})->dispatch();

Improved Rate Limiting

Laravel’s request rate limiter functionality has been improved with more flexibility and power. The functionality has also maintained its backwards compatibility with previous release’s throttle middleware API.

Laravel 8 Maintenance Mode Enhancement

Previously, to access the application which is in the ‘php artisan down’ maintenance mode may be bypassed using an ‘allow list’ of IP addresses. However, in Laravel 8 this has been made simpler with ‘secret’ and token. Now all people need is the secret key to view the page even it’s down.

While in maintenance mode, you may use the ‘secret’ option to specify a maintenance mode bypass token as shown in the example below:

php artisan down --secret="example-secret-token-4b66-afa1-dd72a4c43515"

After placing the application in maintenance mode, you may navigate to the application URL matching this token and Laravel will issue a maintenance mode bypass cookie to your browser:

https://example.com/example-secret-token-4b66-afa1-dd72a4c43515

laravel php web-development programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...

PHP Website Development

Skenix Infotech is a leading PHP Web Development Company that helps companies get results with industry best practices. Get affordable PHP Development Services.

Laravel Development Company

Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

Hire PHP Developer

Looking to develop a PHP based website from scratch or revamp your existing website? **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")** has always been an industry leader for companies and business owners looking to hire...