Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows deep nesting for submodules. I am not sure if this is something that is highly requested, I could not find a similar PR or issue regarding this. Currently, Twill allows a single nested module, but it's possible a project may require further nesting as I have found. Consider the following modules and their relationships:
So, as Laravel nested resources allow, you could have a route as such:
/clients/3/projects/5/applications/2
I have made the required changes however it might need some extra testing? I tried it out on a project I'm using with Twill and I could get these changes to work regarding routing, creating, editing, deleting, etc. I am fairly new to contributing to open source so please bear with me if you need more coverage. I am also new to unit testing, so if anyone could help me out in this regard that would be much appreciated, if required.
The syntax is essentially how the docs portray a regular submodule, you just add the extra modules in the nest with dot notation, for example:
And then views also take the same breadth:
resources/views/admin/clients/projects/applications
A lot of the changes to support this deep nesting lies in the arguments for controller actions - as the method for retrieving an ID depended on there being strictly 1-2 parameters coming from the route. This is limiting because this assumes there would only ever be 1 level nested. Now, these controller actions depend on the Illuminate\Http\Request class to gather the route and its array of parameters to predictably determine the nesting level and its parents ID. If this imposes a security risk I am not aware of, please let me know, and we will work to a better solution.