Support the ongoing development of Laravel.io →
Input Views Installation
Last updated 1 year ago.
0

Why would a database be a dumb solution for this?

0

thomastkim said:

Why would a database be a dumb solution for this?

Well if nothing else works then its the only solution and then its ok :P But just to answer why i think it is dumb: I found 2 ways to do that, 1 create aboutUs table with columns phone,email and etc. that way i will have a table with just 1 column.. 2nd way is to create a table contact-column table and assign as many columns that user wants.. but that way i kinda lose the control.. I could create requests that let them only add data i want but that needs something more complex :)

Maybe im thinking of it wrong :P im looking forward for opinions

Last updated 8 years ago.
0

How about a cache value without expiration date? But that obviously depends strongly on your cache driver. :) Just an idea.

0

ftiersch said:

How about a cache value without expiration date? But that obviously depends strongly on your cache driver. :) Just an idea.

Well im new in laravel and i don't know all its features in depth.. But caching something like that sounds a bit complex (just an opinion based on the theory of caching, zero experience with cache drivers with laravel until now though :) ). Maybe more details would help me decide if it's worth going that way.

0

You should just use a database for this, but when you say you're going to let users edit their contact us page, what exactly do you mean? Are people submitting an inquiry to your contact page or do you mean they get to create their own forms?

0

I think he means that he wants user (i.e. admins) to be able to edit the global contacts page of the site - CMS style.

@nikooiko Well, it wouldn't actually be caching since it's just the abuse of the Caching methods of Laravel. :)

Cache::get('contactspage');
Cache::put('contactspage', 'test', 10);
Cache::forever('contactspage', '<form><input type="text"></form>');
  1. The first line lets you read something (in this case your HTML) from the Cache.
  2. The second line puts it in the Cache (make sure you use the same key and that it's unique across your site). The 10 at the end means this Cache value automatically expires after 10 minutes so that wouldn't be the right one for you.
  3. The third line is basically a wrapper of the put() method but it saves the value indefinitely - without expiration.

Your cache config (config/cache.php) determines, where it will be saved. If you use the File driver it will be saved into the storage folder.

http://laravel.com/docs/5.1/cache

Again, I'm not really sure this is a viable way to go, I don't have a lot of experience with the Caches yet. It's just a reaaally simple way. :)

0

Well anyway its a cool way to go :P but i could simplify it by using a file directly (like a log file). Just create a file (ex. xml for easier parsing) and store data there.. That feels better than using the database. I'm going to try it.

Last updated 8 years ago.
0

I used json file in the storage and feels simple and clean enough for what I need. I'm gonna stick with that. ;)

thanks for the responses!

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

nikooiko nikooiko Joined 24 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.