Support the ongoing development of Laravel.io →
Database Views Blade
Last updated 2 years ago.
0

Can you explain a use case for this, so we can help with a solution? I did notice a previous post where you had mentioned difficulty knowing where or in what file to save what. Are you looking for a method for 'storing' macros and other items? I understand the frustration that comes with being uncertain where to save those items! If you are looking for a way to do that, I'm more than happy to share what's worked best for me!

If not, can you just give some more background on why you're needing to store this in a database?

Thanks!

Last updated 2 years ago.
0

Thank you for reply and understanding the problem I have (where to put what), but this is not the case.

What I want to do in this case is simply store a link (macro as mentioned above) so for example I am developing on my localhost server lets say with domain kyslik.dev, so when I store full link in this setup in database kyslik.dev/user/1 for example, domain is not going to change ever I mean unless I edit it manually, but when I store something like {{ HTML::linkRoute('user-detail', array('id' => '1')) }}, I am assured that whatever domain changes link pulled out of database is going to work no matter what (route must exists).

The question is can I store macros in database in order to use them with blade when retrieving data from DB?

scenario

database entry column named description with data: "See more info {{ HTML::linkRoute('items.show', 'Show item #4', array(4)) }}"

somewhere in view: {{ $description }}

Last updated 2 years ago.
0

You could better store links relative from the root. So not kyslik.dev/user/1 but /user/1

Last updated 2 years ago.
0

Yes but you see I do not want to store links, I want to store routes. It might be wrong but I see a big plus, I can simply change one line (in route file) instead of changing scripts and database entries already in database.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Kyslik kyslik Joined 23 Jul 2014

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.