Convert string to path

Asked

Viewed 61 times

0

I would like to save the route in the database.

So I saved it like this. Example:

Route table

| id | rota |
|  1 | route( 'login' ) 

Then I would like to recover and use as route even in Laravel, in Blade.php

I’m trying to do it like this:

<a href="{{ $rota->rotas }}">Link</a>

It shows the text as a link and not the route link

http://localhost/route('login')

Is it possible?

Convert the text that came from the database to the route itself?

I would not like to save the url anyway, because your change the url I will have to go in the bank, but if it is the way I change

  • 1

    Saving only 'login' in the database and in the <a href="{{ route($route->routes) }}">Link</a> view would not solve?

  • It won’t. It show the string

  • In case you set a route in the database, or want you can call these routes by the database, for example route login would return the login name path, or when setting this route in the database it would exist?

  • I want to save the route in the database. I’d like to call the route through the database.. That even when calling login, return I could mount route('login')

  • 1

    I don’t understand why it will show the string. If you use the route helper('column of the database') you should show what you have there. Ex https://implode.io/C0qPqH

  • Exactly. It shows what is in the bank and not route that I would like. Ex.: If I saved in the bank route('login'), and try to put in the url like this: <a hre="{{ $rota }}">rota </a> when I pass the cursor over the url it shows so: localhost://meuapp/route('login') not the url configured on the route that would be localhost://meuapp/login

  • Use the route helper. Test with {{ route($route) }}

  • I will search how to use this route helper

  • You have an example of what it would be like.. The ones I found would not solve

  • In my previous comment I had already written route('login'), this already creates the url for the link. <a href="{ː route($rota) }}">CLICK</a>

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.