organization = $organization; if ($shortcut?->exists) { abort_unless($shortcut->organization_id === $organization->id || $shortcut->isGlobal(), 404); if ($shortcut->isGlobal()) { abort_unless(auth()->user()->hasRole('Administrateur'), 403); } $this->shortcut = $shortcut; $this->global = $shortcut->isGlobal(); $this->label = $shortcut->label; $this->url = $shortcut->url; $this->icon = $shortcut->icon ?? ''; } else { abort_if($global && ! auth()->user()->hasRole('Administrateur'), 403); $this->global = $global; } } public function save(): void { $validated = $this->validate([ 'label' => 'required|string|max:255', 'url' => 'required|url|max:2048', 'icon' => 'nullable|string|max:10', ]); if ($this->shortcut?->exists) { $this->shortcut->update($validated); session()->flash('status', "Raccourci « {$this->shortcut->label} » mis à jour."); } else { Shortcut::create([ ...$validated, 'organization_id' => $this->global ? null : $this->organization->id, 'created_by' => auth()->id(), ]); session()->flash('status', "Raccourci « {$this->label} » créé."); } $this->redirectRoute('organizations.shortcuts.index', $this->organization, navigate: true); } }; ?>
{{ $organization->name }}
Ce raccourci sera visible depuis toutes les organisations.
@endif