I have updated the role_has_permissions table with additional column. I need to check this column when checking a permission (Basically extending "can" function as below). Is this even possible?
$user->can('CREATE_INVOICE','MODULE_ID');
Also to extend 'givePermissionTo' function.
$role->givePermissionTo('PRINT_INVOICE','MODULE_ID');
Eg: One User role will have "Manage billing on Car Rentals", but does not have "Manage billing on Bus rentals". Same permission called "Manage billing".

You can use Teams permissions feature to check the modules: Team Permissions
In
config/permission.phpfile:Create a middleware to set the module_id:
Add the middleware to request lifecycle and that's it.