From dd881283b5af1b328db578785b16793faa4863a2 Mon Sep 17 00:00:00 2001 From: Prawy_126 Date: Tue, 4 Jun 2024 23:43:45 +0200 Subject: [PATCH] =?UTF-8?q?W=20ko=C5=84cu=20chyba=20dzia=C5=82a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AnnouncementController.php | 5 +- Projekt/resources/views/cars/edit.blade.php | 47 ++++++++++++++++--- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Projekt/app/Http/Controllers/AnnouncementController.php b/Projekt/app/Http/Controllers/AnnouncementController.php index 5eeb466..cb06e2a 100644 --- a/Projekt/app/Http/Controllers/AnnouncementController.php +++ b/Projekt/app/Http/Controllers/AnnouncementController.php @@ -103,7 +103,6 @@ public function edit($id) public function update(Request $request, $id) { - dd($request); $request->validate([ 'name' => 'required|string|max:30', 'brand' => 'required|string|max:30', @@ -146,7 +145,7 @@ public function update(Request $request, $id) return redirect()->route('cars.show', $announcement->id)->with('error', 'Nie można zaktualizować zakończonej aukcji.'); } - $announcement->update($request->all()); + $announcement->update($request->only(['name', 'brand', 'year', 'mileage', 'description', 'min_price', 'end_date', 'end_date'])); if ($request->hasFile('images')) { foreach ($request->file('images') as $image) { @@ -159,9 +158,9 @@ public function update(Request $request, $id) } } - return redirect()->route('cars.show', $announcement->id)->with('success', 'Ogłoszenie zostało zaktualizowane.'); } + public function create() { return view('announcements.create'); diff --git a/Projekt/resources/views/cars/edit.blade.php b/Projekt/resources/views/cars/edit.blade.php index 2bcb04a..32db12b 100644 --- a/Projekt/resources/views/cars/edit.blade.php +++ b/Projekt/resources/views/cars/edit.blade.php @@ -20,51 +20,84 @@ @endif -
+ @csrf @method('PUT')
- +
- +
- +
- +
- +
+
- +
+
+ + +
+ + + Anuluj +
+
+

Aktualne zdjęcia

+ @foreach ($announcement->photos as $photo) +
+ +
+ @csrf + @method('DELETE') + +
+
+ @endforeach +
+
+ + @include('shared.footer', ['fixedBottom' => true])