Skip to content

Get environment

Code

if (App::environment(['local', 'staging'])) {
    //code goes here 
}

// or 

if (app()->environment(['local', 'staging'])) {
    //code goes here
}

Blade

@if(App::environment('production'))
    {{-- in "production" environment --}}
@endif
@production
    {{-- in "production" environment --}}
@endproduction
@env('local', 'staging')
    {{-- in "local" or "staging" environment --}}
@endenv