Listing details
Everything important, laid out cleanly.
Description
Seller notes, condition, and extra context.
{{ $sellerName }}
Videos
Additional media attached to the listing.
{{ $video->titleLabel() }}
@extends('app::layouts.app') @section('content') @php $title = trim((string) ($listing->title ?? '')); $displayTitle = $title !== '' ? $title : 'Untitled listing'; $priceLabel = 'Price on request'; if (! is_null($listing->price)) { $priceValue = (float) $listing->price; $formattedPrice = number_format($priceValue, 2, '.', ','); $formattedPrice = rtrim(rtrim($formattedPrice, '0'), '.'); $priceLabel = $priceValue > 0 ? $formattedPrice.' '.($listing->currency ?: 'TRY') : 'Free'; } $locationLabel = collect([$listing->city, $listing->country]) ->filter(fn ($value) => is_string($value) && trim($value) !== '') ->implode(' / '); $publishedAt = $listing->created_at?->format('M j, Y') ?? 'Recently'; $postedAgo = $listing->created_at?->diffForHumans() ?? 'Listed recently'; $galleryImages = collect($gallery ?? []) ->filter(fn ($value) => is_string($value) && trim($value) !== '') ->values() ->all(); $initialGalleryImage = $galleryImages[0] ?? null; $galleryCount = count($galleryImages); $description = trim((string) ($listing->description ?? '')); $displayDescription = $description !== '' ? $description : 'No description added for this listing.'; $sellerName = trim((string) ($listing->user?->name ?? 'Marketplace Seller')); $sellerInitial = mb_strtoupper(mb_substr($sellerName, 0, 1)); $sellerMemberText = $listing->user?->created_at ? 'Member since '.$listing->user->created_at->format('M Y') : 'New seller'; $referenceCode = '#'.str_pad((string) $listing->getKey(), 8, '0', STR_PAD_LEFT); $canContactSeller = $listing->user && (! auth()->check() || (int) auth()->id() !== (int) $listing->user_id); $isOwnListing = auth()->check() && (int) auth()->id() === (int) $listing->user_id; $canStartConversation = auth()->check() && $listing->user && ! $isOwnListing; $loginRedirectRoute = route('login', ['redirect' => request()->fullUrl()]); $chatConversation = $detailConversation ?? null; $chatMessages = $chatConversation?->messages ?? collect(); $chatSendUrl = $chatConversation ? route('conversations.messages.send', $chatConversation) : ''; $chatStartUrl = route('conversations.start', $listing); $primaryContactHref = null; $primaryContactLabel = 'Call'; if (filled($listing->contact_phone)) { $primaryContactHref = 'tel:'.preg_replace('/\s+/', '', (string) $listing->contact_phone); $primaryContactLabel = 'Call'; } elseif (filled($listing->contact_email)) { $primaryContactHref = 'mailto:'.$listing->contact_email; $primaryContactLabel = 'Email'; } $reportEmail = config('mail.from.address', 'support@example.com'); $reportUrl = 'mailto:'.$reportEmail.'?subject='.rawurlencode('Report listing '.$referenceCode); $shareUrl = route('listings.show', $listing); $specRows = collect([ ['label' => 'Price', 'value' => $priceLabel], ['label' => 'Published', 'value' => $publishedAt], ['label' => 'Listing ID', 'value' => $referenceCode], ['label' => 'Category', 'value' => $listing->category?->name ?? 'General'], ['label' => 'Location', 'value' => $locationLabel !== '' ? str_replace(' / ', ' / ', $locationLabel) : 'Not specified'], ]) ->merge( collect($presentableCustomFields ?? [])->map(fn (array $field) => [ 'label' => trim((string) ($field['label'] ?? '')), 'value' => trim((string) ($field['value'] ?? '')), ]) ) ->filter(fn (array $item) => $item['label'] !== '' && $item['value'] !== '') ->unique(fn (array $item) => mb_strtolower($item['label'])) ->values(); @endphp
{{ $listing->category?->name ?? 'Marketplace listing' }}
Everything important, laid out cleanly.
Seller notes, condition, and extra context.
{{ $sellerName }}
Additional media attached to the listing.
{{ $video->titleLabel() }}