How can I edit the .env file from filament dasboard?

I’m building a new laravel dashboard using the Filament library. I want to add some settings that allow the user to change some .env values namely the website URL and the DEBUG mode. This is my implementation:

Card::make()->schema([
    TextInput::make('siteUrl')
        ->label('URL')
        ->placeholder('http://localhost')
        ->helperText('Required for file uploads and other internal configs')
        ->required(),
    Toggle::make('debugEnabled')
        ->label('Is Enabled')
        ->helperText('Enable/Disable debug mode to help debug errors')
]),

This successfully saves the settings to the database but I can’t figure out how I can persist the changes into the .env file.

Any help would be appreciated. Thanks