Skip to main content

Improve Laravel development experience

Published 1 min readMarkdown
Part of seriesLaravel
Improve Laravel development experience

Add it to the boot method of the AppServiceProvider of the app to improve Laravel developmet experience.

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class AppServiceProvider extends ServiceProvider
{
    //...

    public function boot(): void
    {
        Model::shouldBeStrict();
        Model::unguard();
        DB::prohibitDestructiveCommands(app()->isProduction());
        Date::use(CarbonImmutable::class);
    }
}

About the author

  • Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

No comments yet. Be the first to comment.