I just started playing with laravel hasing coming from codeigniter, and I'm trying to find a better way to determine the sequence of constants. CI uses the constants folder in the / config application, and I was pretty much pleased with this approach for most things, but wanted advice on the best way to do this in Laravel.
My constants are divided into 3 categories, and I would like, if possible, to advise on the best way to store and retrieve them (bearing in mind that I am completely not familiar with Laravel.
Type 1 : Constants that need to be loaded every time the controller is called: for example, I would like to start by defining a constant, to tell me if the user requests content via ajax, this is what I used in the constant file CI: define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
Type 2 : Constants that can be changed by the user: Are they best stored in a database or written to a configuration file? Again looking for tips on how to store and retrieve
Type 3 : Constants that are only needed by specific controllers: Ideally, I would like to be able to group constants into arrays or individual files and pull them out in groups as needed. for example, I could just load the download settings for my download controller.
Thanks for any help / advice in advance - examples would be greatly appreciated
source share