Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12e4079126 | ||
|
|
1871c04507 | ||
|
|
dfd3f77a5d |
No files matched your search
@@ -21,6 +21,7 @@ public static function configure(Schema $schema): Schema
|
||||
SpatieMediaLibraryFileUpload::make('image')
|
||||
->label('Bild')
|
||||
->collection(Photo::COLLECTION)
|
||||
->disk('public')
|
||||
->image()
|
||||
->imageEditor()
|
||||
->maxSize(25 * 1024)
|
||||
|
||||
@@ -45,7 +45,9 @@ protected function casts(): array
|
||||
|
||||
public function registerMediaCollections(): void
|
||||
{
|
||||
// Website photos are public files; the app's default disk (FILESYSTEM_DISK=local) is private.
|
||||
$this->addMediaCollection(self::COLLECTION)
|
||||
->useDisk('public')
|
||||
->singleFile()
|
||||
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/webp']);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Photo;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Photos uploaded in the admin landed on the private default disk ("local"), so the website could not
|
||||
* show them. Moves their files (original and web sizes, folder = media id) to the public disk.
|
||||
* Safe to run again: only media not yet on the public disk are touched.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$media = DB::table('media')
|
||||
->where('model_type', Photo::class)
|
||||
->where(fn ($query) => $query->where('disk', '!=', 'public')->orWhere('conversions_disk', '!=', 'public'))
|
||||
->get(['id', 'disk', 'conversions_disk']);
|
||||
|
||||
foreach ($media as $item) {
|
||||
$folder = (string) $item->id;
|
||||
$public = Storage::disk('public');
|
||||
$disks = array_values(array_diff(array_unique([$item->disk, $item->conversions_disk ?: $item->disk]), ['public']));
|
||||
|
||||
if (array_filter($disks, fn (string $diskName): bool => config("filesystems.disks.{$diskName}") === null) !== []) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($disks as $diskName) {
|
||||
|
||||
$source = Storage::disk($diskName);
|
||||
foreach ($source->allFiles($folder) as $file) {
|
||||
$public->writeStream($file, $source->readStream($file));
|
||||
}
|
||||
$source->deleteDirectory($folder);
|
||||
}
|
||||
|
||||
DB::table('media')->where('id', $item->id)->update(['disk' => 'public', 'conversions_disk' => 'public']);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Files stay public; moving them back to a private disk would hide them from the website again.
|
||||
}
|
||||
};
|
||||
@@ -150,6 +150,7 @@ ## 8. Bekannte Eigenheiten und Lösungen
|
||||
| Nach dem Umschalten lief die alte Version weiter | Strato-OPcache speichert Skripte unter dem Symlink-Pfad `current/…` | `.htaccess` zeigt auf den konkreten Ordner `releases/<version>/public` und wird bei jedem Umschalten neu geschrieben |
|
||||
| Links mit `/current/public` (z. B. Sitemap) | Laravel leitet den Basis-Pfad aus dem Skript-Pfad ab | `URL::forceRootUrl(APP_URL)` außerhalb von local/testing (`AppServiceProvider`) |
|
||||
| HTTP 500 „Composer platform“ | Web-PHP des Pakets ist 8.3 | `AddType application/x-httpd-php84 .php` in der Ordner-`.htaccess` |
|
||||
| Im Admin hochgeladenes Foto erscheint in der Fotoliste, auf der Website/im Grundriss-Editor aber als leeres Bild (HTTP 403) | Upload-Feld nahm Filaments Standard-Speicher `FILESYSTEM_DISK=local` (privat, `storage/app/private/<media-id>`); Import und Website nutzen `public` | Seit 23.10.2026 (`1871c04`): Fotos immer auf `public` (`Photo`-Sammlung `useDisk('public')`, Upload-Feld `->disk('public')`); Migration `2026_10_23_171001_move_photo_media_to_the_public_disk` hat vorhandene private Fotos verschoben (stommer.info: Foto 41). Direkt nach dem Verschieben kann Strato die Adresse kurz noch mit 403 beantworten |
|
||||
| SSH „connection closed“ | falscher Server `ssh.strato.de` | paketspezifischer Server (§2) |
|
||||
| Domain-Ziel `current/public` nicht wählbar | Strato erlaubt kein Symlink-Ziel | Domain auf den Deploy-Ordner, `.htaccess` leitet weiter |
|
||||
| Ersteinrichtung mit Factories schlägt fehl | Produktion ohne Dev-Pakete | `ProductionSeeder` |
|
||||
|
||||
+3
-1
@@ -109,6 +109,8 @@ ## 6. Design-Theme „Seebad“ (Abschnitt der Design-Session)
|
||||
|
||||
**Fertig:** alle 15 Bausteine, Kopf/Fuß/Banner/mobile Buchungsleiste, Logo aus `styles/satz4` (SVG-Master + WebP), Favicon (Eckbau mit Rundbogengaube), Bäderstil-Details des Hauses (Rundbogen mit Fasche und Schlussstein, Rundbogengaube, Kopfbänder als Eckkonsolen, Balkongeländer), Farben aus dem Logo, Schriften selbst gehostet. Gearbeitet wird im eigenen Worktree auf `theme/seebad`, ausgeliefert nur über `main`.
|
||||
|
||||
**Behoben 23.10.2026:** Im Admin hochgeladene Fotos landeten im privaten Speicher und waren auf der Website unsichtbar (403) – jetzt immer öffentlich, vorhandene per Migration verschoben (BETRIEB.md §8).
|
||||
|
||||
**Offen (Design):**
|
||||
- Ziffer 0 mit Schrägstrich (Schrift Atkinson Hyperlegible) in Preisen und Daten – Entscheidung Lars: lassen oder Preise/Daten in anderer Schrift.
|
||||
- Seite „Kühlungsborn“ wirkt leer, bis es den Baustein „Tipps der Gastgeberin“ gibt (Vignetten liegen bereit: `motifs/vignette-*.svg`).
|
||||
@@ -121,7 +123,7 @@ ## 6. Design-Theme „Seebad“ (Abschnitt der Design-Session)
|
||||
|
||||
| Baustein | Daten / Admin | Darstellung | Abhängig von |
|
||||
|---|---|---|---|
|
||||
| Interaktiver Grundriss – **gebaut** (23.10.2026, Branch `feature/bausteine`) | Tabelle `floor_plans` (`tenant_id`, eine je Wohnung, Bild = Foto aus Webseite › Fotos, Räume als JSON: Name, Text, Hinweis, Fotos, Ausstattung, sichtbar, Ecken in %); Admin › Webseite › Grundriss mit Eckpunkt-Editor (`resources/views/filament/forms/floor-plan-area.blade.php`, nur Expertenansicht) | Baustein `floor_plan`; Seebad: Flächen und Raum-Tasten wählen einen Raum, Kartusche mit Foto/Ausstattung/Hinweis; ohne JS Liste. Rendering: `styles/grundriss/` | **Mandanten Phase 5:** `floor_plans` beim Export/Löschen eines Mandanten mitnehmen |
|
||||
| Interaktiver Grundriss – **gebaut** (23.10.2026, Branch `feature/bausteine`) | Tabelle `floor_plans` (`tenant_id`, eine je Wohnung, Bild = Foto aus Webseite › Fotos, Räume als JSON: Name, Text, Hinweis, Fotos, Ausstattung, sichtbar, Ecken in %); Admin › Webseite › Grundriss mit Eckpunkt-Editor (Ecken setzen, ziehen, mit Pfeiltasten feinjustieren, auf Kanten einfügen, per Doppelklick/Entf löschen) (`resources/views/filament/forms/floor-plan-area.blade.php`, nur Expertenansicht) | Baustein `floor_plan`; Seebad: Flächen und Raum-Tasten wählen einen Raum, Kartusche mit Foto/Ausstattung/Hinweis; ohne JS Liste. Rendering: `styles/grundriss/` | **Mandanten Phase 5:** `floor_plans` beim Export/Löschen eines Mandanten mitnehmen |
|
||||
| Tipps der Gastgeberin | eigene Liste je Website (Ort, Kategorie, Weg/Gehzeit, Text, Foto, Karten-Link, Saison) | Liste mit Vignette je Kategorie | Bildwelt (Vignetten je Kategorie) |
|
||||
| Gut zu wissen | strukturierte Felder an der Wohnung (Zugang, Dusche, Haustiere, An-/Abreise, Parken) – auch für Angebot/Mail/JSON-LD | Kartusche | – (klein) |
|
||||
| Belegungs-/Preiskalender (nur ansehen) | vorhandene Daten (`AvailabilityChecker`, `PriceCalculator`) | Monatsansicht, Livewire oder statisch gerendert | – |
|
||||
|
||||
@@ -18,35 +18,98 @@
|
||||
<div
|
||||
x-data="{
|
||||
state: $wire.$entangle('{{ $getStatePath() }}'),
|
||||
points() { return String(this.state ?? '').trim().split(/\s+/).filter((pair) => /^\d+(\.\d+)?,\d+(\.\d+)?$/.test(pair)) },
|
||||
add(event) {
|
||||
const box = this.$refs.plan.getBoundingClientRect()
|
||||
const x = Math.min(100, Math.max(0, Math.round((event.clientX - box.left) / box.width * 1000) / 10))
|
||||
const y = Math.min(100, Math.max(0, Math.round((event.clientY - box.top) / box.height * 1000) / 10))
|
||||
this.state = [...this.points(), x + ',' + y].join(' ')
|
||||
dragging: null,
|
||||
pairs() {
|
||||
return String(this.state ?? '').trim().split(/\s+/)
|
||||
.filter((pair) => /^\d+(\.\d+)?,\d+(\.\d+)?$/.test(pair))
|
||||
.map((pair) => pair.split(',').map(Number))
|
||||
},
|
||||
undo() { this.state = this.points().slice(0, -1).join(' ') },
|
||||
write(pairs) { this.state = pairs.map(([x, y]) => x + ',' + y).join(' ') },
|
||||
clamp(value) { return Math.min(100, Math.max(0, Math.round(value * 10) / 10)) },
|
||||
position(event) {
|
||||
const box = this.$refs.plan.getBoundingClientRect()
|
||||
return [this.clamp((event.clientX - box.left) / box.width * 100), this.clamp((event.clientY - box.top) / box.height * 100)]
|
||||
},
|
||||
midpoints() {
|
||||
const pairs = this.pairs()
|
||||
if (pairs.length < 2) return []
|
||||
return pairs.map((a, index) => {
|
||||
const b = pairs[(index + 1) % pairs.length]
|
||||
return { index, x: this.clamp((a[0] + b[0]) / 2), y: this.clamp((a[1] + b[1]) / 2) }
|
||||
}).slice(0, pairs.length === 2 ? 1 : pairs.length)
|
||||
},
|
||||
add(event) {
|
||||
this.write([...this.pairs(), this.position(event)])
|
||||
},
|
||||
startDrag(index, event) {
|
||||
this.dragging = index
|
||||
event.target.setPointerCapture(event.pointerId)
|
||||
},
|
||||
drag(event) {
|
||||
if (this.dragging === null) return
|
||||
const pairs = this.pairs()
|
||||
pairs[this.dragging] = this.position(event)
|
||||
this.write(pairs)
|
||||
},
|
||||
endDrag() { this.dragging = null },
|
||||
insert(index) {
|
||||
const pairs = this.pairs()
|
||||
const middle = this.midpoints().find((point) => point.index === index)
|
||||
pairs.splice(index + 1, 0, [middle.x, middle.y])
|
||||
this.write(pairs)
|
||||
},
|
||||
remove(index) {
|
||||
const pairs = this.pairs()
|
||||
pairs.splice(index, 1)
|
||||
this.write(pairs)
|
||||
},
|
||||
nudge(index, dx, dy, event) {
|
||||
const step = event.shiftKey ? 1 : 0.2
|
||||
const pairs = this.pairs()
|
||||
pairs[index] = [this.clamp(pairs[index][0] + dx * step), this.clamp(pairs[index][1] + dy * step)]
|
||||
this.write(pairs)
|
||||
},
|
||||
undo() { this.write(this.pairs().slice(0, -1)) },
|
||||
clear() { this.state = '' },
|
||||
}"
|
||||
>
|
||||
<div x-ref="plan" x-on:click="add($event)" style="position:relative;cursor:crosshair;user-select:none;border:1px solid #e4e4e7;border-radius:.5rem;overflow:hidden">
|
||||
<div x-ref="plan" x-on:click="add($event)" x-on:pointermove="drag($event)" x-on:pointerup="endDrag()" x-on:pointercancel="endDrag()"
|
||||
style="position:relative;cursor:crosshair;user-select:none;touch-action:none;border:1px solid #e4e4e7;border-radius:.5rem;overflow:hidden">
|
||||
<img src="{{ $planPhoto->url('lg') }}" alt="" draggable="false" style="display:block;width:100%;height:auto">
|
||||
<svg viewBox="0 0 100 100" preserveAspectRatio="none" style="position:absolute;inset:0;width:100%;height:100%;pointer-events:none" aria-hidden="true">
|
||||
@foreach ($otherAreas as $area)
|
||||
<polygon points="{{ $area }}" fill="rgba(37,99,235,.10)" stroke="#2563eb" stroke-width="1.5" vector-effect="non-scaling-stroke" />
|
||||
@endforeach
|
||||
<polygon x-bind:points="points().join(' ')" fill="rgba(217,119,6,.28)" stroke="#d97706" stroke-width="2.5" vector-effect="non-scaling-stroke" />
|
||||
<polygon x-bind:points="pairs().map((pair) => pair.join(',')).join(' ')" fill="rgba(217,119,6,.28)" stroke="#d97706" stroke-width="2.5" vector-effect="non-scaling-stroke" />
|
||||
</svg>
|
||||
<template x-for="(point, index) in points()" x-bind:key="index">
|
||||
<span x-bind:style="`position:absolute;left:${point.split(',')[0]}%;top:${point.split(',')[1]}%;width:12px;height:12px;margin:-6px 0 0 -6px;background:#fff;border:2px solid #d97706;border-radius:2px`"></span>
|
||||
<template x-for="point in midpoints()" x-bind:key="'m' + point.index">
|
||||
<button type="button" x-on:click.stop="insert(point.index)" x-bind:aria-label="'Punkt zwischen Ecke ' + (point.index + 1) + ' und der nächsten einfügen'" title="Punkt einfügen"
|
||||
x-bind:style="`position:absolute;left:${point.x}%;top:${point.y}%;width:18px;height:18px;margin:-9px 0 0 -9px;padding:0;border-radius:999px;border:1.5px solid #d97706;background:rgba(255,255,255,.85);color:#b45309;font:600 13px/1 sans-serif;cursor:copy`">+</button>
|
||||
</template>
|
||||
<template x-for="(pair, index) in pairs()" x-bind:key="'p' + index">
|
||||
<button type="button"
|
||||
x-on:pointerdown.stop="startDrag(index, $event)"
|
||||
x-on:click.stop
|
||||
x-on:dblclick.stop="remove(index)"
|
||||
x-on:keydown.arrow-left.prevent="nudge(index, -1, 0, $event)"
|
||||
x-on:keydown.arrow-right.prevent="nudge(index, 1, 0, $event)"
|
||||
x-on:keydown.arrow-up.prevent="nudge(index, 0, -1, $event)"
|
||||
x-on:keydown.arrow-down.prevent="nudge(index, 0, 1, $event)"
|
||||
x-on:keydown.delete.prevent="remove(index)"
|
||||
x-bind:aria-label="'Ecke ' + (index + 1) + ' – ziehen oder mit den Pfeiltasten verschieben, Entf löscht'"
|
||||
x-bind:title="'Ecke ' + (index + 1)"
|
||||
x-bind:style="`position:absolute;left:${pair[0]}%;top:${pair[1]}%;width:16px;height:16px;margin:-8px 0 0 -8px;padding:0;background:${dragging === index ? '#d97706' : '#fff'};border:2px solid #d97706;border-radius:3px;cursor:${dragging === index ? 'grabbing' : 'grab'};touch-action:none`"></button>
|
||||
</template>
|
||||
</div>
|
||||
<div style="display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:.5rem">
|
||||
<span style="font-size:.875rem;color:#52525b" x-text="points().length + (points().length === 1 ? ' Eckpunkt' : ' Eckpunkte')"></span>
|
||||
<x-filament::button size="sm" color="gray" x-on:click="undo()" x-bind:disabled="points().length === 0">Letzten Punkt entfernen</x-filament::button>
|
||||
<x-filament::button size="sm" color="danger" outlined x-on:click="clear()" x-bind:disabled="points().length === 0">Fläche leeren</x-filament::button>
|
||||
<span style="font-size:.875rem;color:#52525b" x-text="pairs().length + (pairs().length === 1 ? ' Eckpunkt' : ' Eckpunkte')"></span>
|
||||
<x-filament::button size="sm" color="gray" x-on:click="undo()" x-bind:disabled="pairs().length === 0">Letzten Punkt entfernen</x-filament::button>
|
||||
<x-filament::button size="sm" color="danger" outlined x-on:click="clear()" x-bind:disabled="pairs().length === 0">Fläche leeren</x-filament::button>
|
||||
</div>
|
||||
<p style="margin-top:.25rem;font-size:.875rem;color:#71717a">Klicken Sie nacheinander die Ecken des Raums auf dem Bild an, im Uhrzeigersinn. Blau umrandet: die anderen Räume.</p>
|
||||
<p style="margin-top:.25rem;font-size:.875rem;color:#71717a">
|
||||
Neue Ecke: auf das Bild klicken. Ecke verschieben: Punkt mit der Maus ziehen oder anklicken und mit den Pfeiltasten bewegen (mit Umschalt in größeren Schritten).
|
||||
Ecke einfügen: „+“ auf einer Kante. Ecke löschen: Doppelklick auf den Punkt oder Entf. Blau umrandet: die anderen Räume.
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
</x-dynamic-component>
|
||||
@@ -8,6 +8,7 @@
|
||||
use App\Filament\Resources\Amenities\AmenityResource;
|
||||
use App\Filament\Resources\Faqs\FaqResource;
|
||||
use App\Filament\Resources\Notices\NoticeResource;
|
||||
use App\Filament\Resources\Photos\Pages\CreatePhoto;
|
||||
use App\Filament\Resources\Photos\Pages\ListPhotos;
|
||||
use App\Filament\Resources\Photos\PhotoResource;
|
||||
use App\Filament\Resources\Properties\PropertyResource;
|
||||
@@ -87,6 +88,42 @@ public function test_several_photos_are_uploaded_at_once(): void
|
||||
$this->assertSame(['Wohn zimmer', 'Kueche'], Photo::orderBy('sort_order')->pluck('alt_text')->all());
|
||||
}
|
||||
|
||||
public function test_photo_uploaded_in_the_admin_is_stored_on_the_public_disk(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
Livewire::test(CreatePhoto::class)
|
||||
->fillForm([
|
||||
'image' => [UploadedFile::fake()->image('grundriss.png', 1600, 900)],
|
||||
'alt_text' => 'Grundriss mit Teppichen',
|
||||
'category' => PhotoCategory::Apartment,
|
||||
])
|
||||
->call('create')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$media = Photo::query()->where('alt_text', 'Grundriss mit Teppichen')->sole()->getFirstMedia(Photo::COLLECTION);
|
||||
$this->assertSame(['public', 'public'], [$media->disk, $media->conversions_disk]);
|
||||
Storage::disk('public')->assertExists($media->id.'/'.$media->file_name);
|
||||
$this->assertSame([], Storage::disk('local')->allFiles());
|
||||
}
|
||||
|
||||
public function test_migration_moves_photos_from_the_private_disk_to_the_public_disk(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
$photo = Photo::factory()->create();
|
||||
$media = $photo->addMedia(UploadedFile::fake()->image('alt.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION, 'local');
|
||||
Storage::disk('local')->assertExists($media->id.'/alt.jpg');
|
||||
|
||||
(require database_path('migrations/2026_10_23_171001_move_photo_media_to_the_public_disk.php'))->up();
|
||||
|
||||
$media->refresh();
|
||||
$this->assertSame(['public', 'public'], [$media->disk, $media->conversions_disk]);
|
||||
Storage::disk('public')->assertExists($media->id.'/alt.jpg');
|
||||
Storage::disk('public')->assertExists($media->id.'/conversions/alt-lg.webp');
|
||||
Storage::disk('local')->assertMissing($media->id.'/alt.jpg');
|
||||
$this->assertStringEndsWith('/conversions/alt-lg.webp', $photo->fresh()->url('lg'));
|
||||
}
|
||||
|
||||
public function test_notices_are_visible_only_within_their_dates(): void
|
||||
{
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-10'));
|
||||
|
||||
Reference in new issue
Block a user