Closed jianminLee closed 5 years ago
class ForgetCachedPermissions { /** * Handle the incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return \Illuminate\Http\Response */ public function handle($request, $next) { $response = $next($request); if ($request->is('nova-api/*/detach') || $request->is('nova-api/*/*/attach/*')) { ##This is my attach url: http://127.0.0.1:8000/nova-api/admins/1/attach-morphed/permissions $permissionKey = (Nova::resourceForModel(app(PermissionRegistrar::class)->getPermissionClass()))::uriKey(); if ($request->viaRelationship === $permissionKey) { app(PermissionRegistrar::class)->forgetCachedPermissions(); } } return $response; } }
Thanks for reporting @jianminLee. Can you make a PR for this? I think $request->is('nova-api/*/*/attach*') may work.
$request->is('nova-api/*/*/attach*')
@paras-malhotra try:
$request->is('nova-api/*/*/attach*/*')
is work.