portfolio) { $this->permissions = [ auth()->user()->id => [ 'owner' => true, 'full_access' => false ] ]; } else { $this->permissions = collect($this->portfolio->users)->mapWithKeys(function ($user) { return [ $user->id => [ 'owner' => $user->pivot->owner ?? 0, 'full_access' => $user->pivot->full_access ?? 0 ] ]; })->toArray(); } } public function updatedPermissions() { $this->authorize('fullAccess', $this->portfolio); $this->portfolio->users()->sync($this->permissions); $this->portfolio->refresh(); $this->success(__('Updated user\'s access permission to portfolio')); } public function deleteUser(string $userId, bool $confirmed = false) { $this->authorize('fullAccess', $this->portfolio); if (!$confirmed) { $this->deletingAccessFor = $userId; $this->confirmingAccessDeletion = true; return; } unset($this->permissions[$userId]); $this->portfolio->unShare($userId); $this->portfolio->refresh(); $this->success(__('Removed user\'s access to portfolio')); // reset $this->confirmingAccessDeletion = false; $this->deletingAccessFor = null; } public function addUser() { $this->authorize('fullAccess', $this->portfolio); $this->validate(); $this->portfolio->share($this->emailAddress, $this->fullAccess); $this->success(__('Shared portfolio with user')); $this->portfolio->refresh(); $this->dispatch('toggle-add-user-modal'); $this->emailAddress = ''; $this->fullAccess = false; } }; ?>
@if ($portfolio?->owner) {{ $portfolio->owner->name }} @if (auth()->user()->id == $portfolio->owner->id) ({{ __('you') }}) @endif {{ __('Owner') }} @endif @foreach (collect($portfolio?->users)->where('pivot.owner', '!=', 1) as $user) {{ $user->name }} @if (auth()->user()->id == $user->id) ({{ __('you') }}) @endif {{ $user->email }} @if (auth()->user()->id != $user->id) @endif @endforeach {{ __('Remove Access') }} {{ __('By removing this person\'s access, they will no longer be able to view this portfolio. They will lose access immediately.') }} {{ __('Cancel') }} {{ __('Remove Access') }}
{{ __('Add People') }}