Laravel 5 Active States on Navigation Links

Active states on navigation
  • you can make use of Laravels HTTP request task
  • it has helper functions like:
    • is() which checks for a pattern which matches the current URI
    • path() – strips of domain name and query string
    • fullurl() – everything
    • url() -everything exept query string
  • tip is to store pages in a database and load navigation dynamically

You could add helper functions to assist with this, such as set_active($path) and include this in nav blade.

Example dynamic nav (might not be needed for smaller projects).
example dynamic nav
Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *