diff --git a/app/Http/Controllers/ListingController.php b/app/Http/Controllers/ListingController.php index e43efe7..7c8c7b8 100644 --- a/app/Http/Controllers/ListingController.php +++ b/app/Http/Controllers/ListingController.php @@ -41,6 +41,7 @@ public function store(Request $request) { if($request->hasFile('logo')) { $formFields['logo'] = $request->file('logo')->store('logos', 'public'); + $formFields['logo'] = 'storage/'.$formFields['logo']; } $formFields['user_id'] = auth()->id(); @@ -61,7 +62,7 @@ public function update(Request $request, Listing $listing) { if($listing->user_id != auth()->id()) { abort(403, 'Unauthorized Action'); } - + $formFields = $request->validate([ 'title' => 'required', 'company' => ['required'], @@ -87,7 +88,7 @@ public function destroy(Listing $listing) { if($listing->user_id != auth()->id()) { abort(403, 'Unauthorized Action'); } - + $listing->delete(); return redirect('/')->with('message', 'Listing deleted successfully'); } diff --git a/resources/views/listings/show.blade.php b/resources/views/listings/show.blade.php index 5ee21c1..c69807c 100644 --- a/resources/views/listings/show.blade.php +++ b/resources/views/listings/show.blade.php @@ -5,7 +5,7 @@
+ src="{{$listing->logo ? asset( $listing->logo) : asset('/images/no-image.png')}}" alt="" />

{{$listing->title}} @@ -48,4 +48,4 @@ class="block bg-black text-white py-2 rounded-xl hover:opacity-80">