Repository navigation
[5.4] Add the method methodsWithoutModels in AuthorizesRequests Trait. - #18916
Conversation
|
@mathieutu Could you add some tests for this? |
|
Actually, this is already tested in Something I could do is to test that the method exists in the controller : public function testMethodsExists()
{
$this->assertTrue(method_exists(new AuthorizesResourcesController(), 'methodsWithoutModels'));
}but there is no test like that for the I also eventually might override the methods in the test controller, add a new entry like in the previous example and check if a new middleware is correctly added at the end, but this is just testing how PHP overriding works, as this is already tested for all other standard resource methods. In fact this is principally about code refactoring here, nothing changed, it's just to allow developers to add easily new methods to their resources (no need to override the |
Hey guys!
In this trait we have the
resourceAbilityMap()which allows us to add directly in controller some methods to check in theauthorize*methods.Actually we can't add methods which doesn't need any parameter, because the setting of
$modelNameis done with a hard coded array.I added this method to fix that.
Example of use :
What do you think about that ?
Thx.