Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:36:39+00:00 2026-06-12T19:36:39+00:00

After a user logs in to an app I am developing, based on their

  • 0

After a user logs in to an app I am developing, based on their role they need to be presented with a different set of menu items.

I have created a filter called “menu” in which I assemble the menu items. I have this in my routes.php to run my filter before everything:

Route::group(array('before' = 'auth|menu'), function()...

At the end of my menu filter I have this to make the menu class accessible in every view:

View::share('menu', $menu);

For actually building the menu I am using the Laravel Menu bundle, but I haven’t yet found the best way to dynamically set the “active” flag of a menu item from my controllers.

The Menu bundle examines the URL to set the active flag (which does not work for me as it seems to be comparing the pathname with URI::current(), only the latter returns the full URL with domain, port and everything, so it never matches) but I would rather like to somehow access the $menu class from within my controllers so I could directly modify it.

How should I do this? Is this situation when one uses a Registry (a.k.a. glorified global variable)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:36:41+00:00Added an answer on June 12, 2026 at 7:36 pm

    Will give u the basic idea and you will be ready to move ahead. Use the IoC container to instantiate the menu object as singleton and then access it from your controller or views. Another way to inject menu is using the View Composer. You can look deep into Laravel docs and source codes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an app (Flash/AS3) that connects to Facebook. After the user logs in
In my app, after user logs in, database is created. When user logs out,
in this app, the user logs in and their credentials are checked against a
I have Scringo all set up in my application. However after the user logs
In my web app after a user logs in a new session is created
I'm developing a desktop application in C#. After visiting https://www.facebook.com/dialog/oauth?client_id=123 the user logs in
In my app after user press start button I execute some code in for
I need an event/events that will do the following: After user selects text/DOM element,
I'm designing a question-and-answer Ruby on Rails application. After a user logs in, you
When a user logs in to a Django app, how do I change the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.