organization->locations()->findOrFail($locationId); $location->delete(); session()->flash('status', "Site \"{$location->name}\" supprimé."); } public function with(): array { return [ 'locations' => $this->organization->locations() ->when($this->search, fn ($query) => $query->where(function ($q) { $q->where('name', 'like', "%{$this->search}%") ->orWhere('city', 'like', "%{$this->search}%"); })) ->orderByDesc('is_primary') ->orderBy('name') ->paginate(15), 'mappedLocations' => $this->organization->locations() ->whereNotNull('latitude') ->whereNotNull('longitude') ->orderBy('name') ->get(['id', 'name', 'city', 'latitude', 'longitude']) ->map(fn ($location) => [ 'name' => $location->name, 'city' => $location->city, 'latitude' => $location->latitude, 'longitude' => $location->longitude, 'edit_url' => route('organizations.locations.edit', [$this->organization, $location]), ]), ]; } }; ?>

{{ $organization->name }}

Sites

+ Nouveau site
@if ($mappedLocations->isNotEmpty())
@endif
@forelse ($locations as $location) @empty @endforelse
Nom Ville Pays Téléphone
{{ $location->name }} @if ($location->is_primary) Principal @endif {{ $location->city ?? '—' }} {{ $location->country ?? '—' }} {{ $location->phone ?? '—' }} Modifier
Aucun site pour le moment.
{{ $locations->links() }}
@once @endonce