I have a navigation section built from a loop of my companies model. So the nav looks like this
@foreach ($companies as $company)
{{ link_to("company/{$company->id}/users", $company->name, ['class' => 'btn btn-xs btn-primary']) }}
@endforeach
This grabs all of the company names and id's to build the button links for each company. this works fine on my companies view, but I also want to include this in the main layout navigation.
What is the best why to do this? I was thinking to add a function to the base controller but not sure how or what view to return?