Laravel dynamic config settings

后端 未结 8 1544
抹茶落季
抹茶落季 2020-12-14 07:13

I\'m using a package within my project and it stores a setting inside config/packagename

I would like to dynamically change this value inside the config

相关标签:
8条回答
  • 2020-12-14 07:46

    config(['packagename.view_id' => Auth::user()->id]);

    0 讨论(0)
  • 2020-12-14 07:47

    You can do like this.

    In your custom config file. Add the following code You can send your id dynamically from the query string.

    'view_id' => isset($_REQUEST['view_id'])?$_REQUEST['view_id']:null,
    

    To get view id

     echo config('app.view_id'); // app is config file name
    
    0 讨论(0)
提交回复
热议问题