Laravel 8, the latest version of the Laravel system, was delivered on September 8. Laravel 8 arrives with excifting new elements and a manual to upgrade. Laravel developer Taylor Otwell reported some of those new components in his Laracon presentation. This post includes a summary of some of the new abilities announced. Let’s take a look at some of those awesome new elements!
New Landing Page
Laravel 8 comes with a unique landing page for a brand renewed install. It is now redesigned and is assembled using TailwindCSS, retains a light and dark-mode abilities, and by default extends links to SaaS developments and community sites.
Controllers Routing Namespacing
No more double prefix problems! In earlier versions of Laravel, the RouteServiceProvider had a feature called namespace that was utilized to prefix the controllers in the routes files. That made a concern when you were attempting to use a callable syntax on your controllers, generating Laravel to incorrectly double prefix it for you. This feature was removed and now you can import and use it without a problem.
Laravel uses route caching to collect your routes in a PHP array that is more efficient to deal with. In Laravel 8, it’s feasible to use this attribute even if you have closures as steps to your routes. This should open the usage of route caching for improved interpretation.
Attributes on Extended Blade Components
In Laravel 7 the child elements didn’t have entrance to the $attributes passed to it. In Laravel 8 these components were improved and it is now achievable to merge nested component features. This makes it more comfortable to complete extended elements.
More useful Syntax for Event Listening
In the earlier versions of Laravel, when conducting a closure-based event listener there was much duplication and a clunky syntax.
Queueable Anonymous Event Listeners
In Laravel 8 it is attainable to create queueable closure from anywhere in the code. This will make a queue of unspecified event listeners that will get managed in the background. This characteristic makes it more comfortable to do this, while in earlier versions of Laravel you would require to use an event class and an event listener (utilizing the ShouldQueue trait).
This is specifically useful when you require to do some supervision on your application and you want to take it down for your users but always let your developers analyze bugs. This will make a secret cookie that will be given to whoever hits the right endpoint, allowing it to operate the application while in maintenance mode.
Laravel and its different first-party packages pursue Semantic Versioning. Primary framework releases are freed every year (~February), while minor and patch dismissals may be released as usually as every week. Minor and patch releases should never include breaking transitions.
Tailwind Pagination Views
The Laravel paginator has been revised to operate the Tailwind CSS framework by default. Tailwind CSS is a favorably customizable, low-level CSS framework that offers you all of the building unions you need to build customized designs without any pesky inflexible styles you have to fight to override. Of course, Bootstrap 3 and 4 ideas remain available as well.
Database Schema Dumping
If you’re working on a big application with a considerable number of database migrations, Laravel 8 has a new procedure called schema dumping to assist you to clean them up. You can drive PHP artisan schema: dump, which makes an SQL file in the database/schema manual that contains your database‘s entire schema as raw SQL. If you run PHP artisan migrate, it will foremost look for a schema file to run and then any regular migration files. By default, you won’t uninstall your current migration files by executing the command. However, if you apply the –prune flag to the instruction, all your migration files will be dismissed, endowing you with a single file of the schema.
New Default App / Models Directory
Rather than leaving the model class in the root app directory, Laravel 8 now crafts with an app/models directory, as in prior versions of Laravel. According to a vote, over 80 percent of developers formed an app/models directory all by themselves.
Removed Controller’s Namespace Prefix
In the aforementioned versions of Laravel, you could utilize a property called $namespace in RouteServiceProvider.php to automatically prefix your controller’s namespace by using App\Http\Controllers. Laravel could have double prefixed your namespaces if you were utilizing the callable syntax in your web.php route’s code. This effect has been released from Laravel 8, so you can import the controller categories to your routes file without any issues.
Laravel Jetstream is a beautifully prepared application for structuring Laravel applications. Jetstream, which was developed using Tailwind CSS, supplies an excellent starting point for new projects with components such as authentication, profile administration, security, and API support utilizing Laravel Sanctum.
Say goodbye to excessive migration folders with the new migration squashing component which lets you smash large migration files into one SQL file. The rendered file will be performed first when you run migrations, Laravel then completes any other migration files that are not parts of the squashed schema file.
As consistently, Taylor Otwell and the rest of the Laravel team have been difficult at work to provide us some amazing and welcome updates to Laravel! Now that you have some knowledge about what's new and what transformed with Laravel 8, feel free to go off and investigate on your own! Leave a remark below letting me know your favorite transformation in Laravel 8 and what you're intending on the building. Learn Laravel from the top best php training institute in kochi iROHUB team can assist you well with that. Cheers!