Tuesday, May 10, 2022

Blade Template #2 | Set Navigation

Simple Navigation (unordered)

  • Type the following code inside the body in app.blade.php.
  • These 2 routes don't exist yet. Head to web.php and type:
  • In controller (prev HelloController.php), create 2 functions about() and service().
  • In browser, you'll get something like this:

Now you have navigation, without any repetition.

Side Note

If you have a route that has a get method and hits controller, and inside of that controller, the only thing you are doing is returning a view with no any other actions, there is a shortcut for that.
  • In the route, you can do this instead:
  • Refresh your browser and everything works well. Except now you don't have to use a controller.
This is a shortcut to get a view in your page right away.

End

No comments:

Post a Comment

Komen atau sebarang pertanyaan di sini :)

DGP: Smart but Stuck (Rajesh)

 Every smart person gets stuck. The smart person always try to hold on to their identity that they're smart. When that happens, they ten...