Laravel Global Settings Model

后端 未结 2 1264
梦如初夏
梦如初夏 2021-01-03 00:44

I\'m working on building a small CRUD app in Laravel 5. I have a few app wide settings such as \"SiteTitle\" and \"BaseURL\" I\'d like to give my admins the ability to chang

2条回答
  •  星月不相逢
    2021-01-03 01:14

    If your app uses multiple controllers then you could define a parent controller that gets extended by all your other controllers. Within the parent controller's constructor you can retrieve the settings data and store it in a class property which will be available to all of the child controller classes. Your child controllers can simply pass this data to the view.

提交回复
热议问题