MikeC
MikeC

Reputation: 146

Links in Laravel

I'm am just starting out in Laravel, been using codeIgniter for years. Very quick question as the Laravel documentation does not seem to address this. Do all links in your blade file have to have defined route in the routes files. In codeigniter it was generally /controller/function in your links but it seems to me in Laravel all links have to be defined in routes file...

Upvotes: 0

Views: 370

Answers (2)

db1975
db1975

Reputation: 775

You can use

{{ url('/what/you/want') }}

https://stackoverflow.com/a/42270157/4173464

Look at https://laravel.com/docs/7.x/urls too

You must define all your routes in Laravel.

Upvotes: 0

Darryl E. Clarke
Darryl E. Clarke

Reputation: 7637

No, they do not have to be defined.

There's nothing prohibiting you from using <a href='/whatever/you/want'> -- That said, it's generally better to use defined routes and reference them by name, that way, if you ever change the actual structures, the route('name'); will automatically resolve to the new structure.

Upvotes: 1

Related Questions