I wouldn't try combing the default Config class with a user-facing config file. Sounds like a really bad idea unless you have a good reason for it. Just my 2 cents though.
mrberggg said:
I wouldn't try combing the default Config class with a user-facing config file. Sounds like a really bad idea unless you have a good reason for it. Just my 2 cents though.
I don't require the class to be called Config, I mean. MyConfig would be just fine, I just need it to be stored on database instead of php files.
This setup stores the database result in the cache for fast access. Just remember to forget the cache when changing the data. (store/update)
With the above setup you can use the Config class
echo Config::get('settings.key'); // value
small correction, the file needs to be placed in
app/config/settings.php
, this is wrong in the link
Why not just call it "Settings" or "AppSettings" or something similar?
zenry said:
This setup stores the database result in the cache for fast access. Just remember to forget the cache when changing the data. (store/update)
With the above setup you can use the Config class
echo Config::get('settings.key'); // value
small correction, the file needs to be placed in
app/config/settings.php
, this is wrong in the link
This seems to help a lot, but it is confusing, Setting is an Eloquent model?
This seems to help a lot, but it is confusing, Setting is an Eloquent model?
yes Setting is a Eloquent Model, I used Setting::all()
but you can add an user_id and do something like Setting::where('user_id', 1)->get()
the table looks like
fyi you can store an array in value
, just create a Mutator (http://laravel.com/docs/eloquent#accessors-and-mutators) that serializes the array before inserting (setValueAtrribute) and unseriailizes the array when using (getValueAttribute)
Just throwing this package out there, might save you some headache.
Thanks zenry, after some coding I figured it out :D
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community