guardFileOwnsItsSharing($file); [$assignable, $targetName] = $this->resolveRequestedTarget( $request, __('Files can only be assigned to clients or groups.'), ); $this->sharing->assign($file, $assignable, $targetName); return back(); } public function destroy(Request $request, File $file): RedirectResponse { Gate::authorize('update', $file); $this->guardFileOwnsItsSharing($file); [$assignable, $targetName] = $this->resolveRequestedTarget( $request, __('Files can only be assigned to clients or groups.'), ); $this->sharing->unassign($file, $assignable, $targetName); return back(); } }