Show navigation badge in sub navigation with count of relationship
I've made pages for a resource and listed those pages as sub navigation items.
In this particular case I have 'notes' as child resource of the parent resource 'Server'
My goal is to show the amount of related notes and an indicator of important notes in the sub navigation.
I've made a working version like this in the Notes Page.
But the main disadvantages of this approach are the tests, I'm unable to mock the request class.
And the value of
I would prefer a solution like this method on the parent resource, where
In this particular case I have 'notes' as child resource of the parent resource 'Server'
My goal is to show the amount of related notes and an indicator of important notes in the sub navigation.
I've made a working version like this in the Notes Page.
But the main disadvantages of this approach are the tests, I'm unable to mock the request class.
And the value of
$record is sometimes the Server model and on the View page the value becomes just the ID of the model.I would prefer a solution like this method on the parent resource, where
Page $page is available.
Solution
Can't you just do something like this to test?
$this->get(Notes::getUrl([..params..]))?