Feature Toggle in laravel

Submitted by saeedvir - 4 years ago

for software different features and set Feature On/Off

create this file in laravel project:



return [
    'loginWithGoogle' => true,
    'newSearchBox' => true,
    'newsLetterBox' => false,
        Some Features ....


then edit the AppServiceProvider and add this Blade Code in boot() function :
        Blade::if('feature', function ($feature) {
            return config("features.$feature", false);

done !

you can use this code in blade files (Views):
    <a href="#" class="btn btn-primary-soft">
        <i class="fa fa-google"></i>
        <span>Login With Google</span>