fix: update public tour functionality

This commit is contained in:
2026-08-20 08:27:53 +03:30
parent 9b7934c0ba
commit 2a980ecc55
2 changed files with 78 additions and 15 deletions
+14 -2
View File
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Tour
*
*
* @property int $id
* @property int|null $travel_type_id
* @property string $title
@@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model;
* @property int $status
* @property Carbon $created_at
* @property Carbon $updated_at
*
*
* @property TravelType|null $travelType
* @property Collection|Flight[] $flights
*
@@ -75,4 +75,16 @@ class Tour extends Model
->withPivot('id')
->withTimestamps();
}
protected static function booted()
{
static::creating(function ($tour) {
// اگر مقداری تعیین نشده بود، پیش‌فرض‌ها را اعمال کن
if (is_null($tour->views_count)) {
$tour->views_count = 0;
}
if (is_null($tour->status)) {
$tour->status = 0; // فرض بر اینکه 0 یعنی غیرفعال/پیش‌نویس
}
});
}
}
+64 -13
View File
@@ -1,19 +1,70 @@
@props(['tour'])
<div class="banner _h-33vh _br-3 banner-animate banner-animate-mask-in">
<div class="card tour-card">
<a href="{{ route('tours.show', $tour) }}">
<img src="{{ $tour->images->first()->path ?? asset('images/placeholder.jpg') }}" class="card-img-top"
alt="{{ $tour->title }}">
<div
class="banner-bg"
style="background-image:url('{{ asset($tour->image) }}');">
</div>
<div class="banner-mask"></div>
<a
class="banner-link"
href="{{ route('tours.show', $tour) }}">
</a>
<div class="card-body">
<h5 class="card-title">
<a href="{{ route('tours.show', $tour) }}">{{ $tour->title }}</a>
<div class="banner-caption _pt-120 banner-caption-bottom banner-caption-grad">
<h5 class="banner-title">
{{ $tour->title }}
</h5>
<p class="card-text">{{ Str::limit($tour->description, 80) }}</p>
<div class="d-flex justify-content-between">
<span>{{ $tour->travelType->title ?? '—' }}</span>
<strong>{{ number_format($tour->price) }} تومان</strong>
</div>
</div>
</div>
{{--<div class="banner _h-33vh _br-3 banner-animate banner-animate-mask-in">--}}
{{-- <div--}}
{{-- class="banner-bg"--}}
{{-- style="background-image:url('{{ asset($image) }}');">--}}
{{-- </div>--}}
{{-- <div class="banner-mask"></div>--}}
{{-- <a--}}
{{-- class="banner-link"--}}
{{-- href="#">--}}
{{-- </a>--}}
{{-- <div class="banner-caption _pt-120 banner-caption-bottom banner-caption-grad">--}}
{{-- <h5 class="banner-title">--}}
{{-- {{ $title }}--}}
{{-- </h5>--}}
{{-- <p class="banner-subtitle">--}}
{{-- {{ $country }}--}}
{{-- </p>--}}
{{-- </div>--}}
{{--</div>--}}
{{--@props(['tour'])--}}
{{--<div class="card tour-card">--}}
{{-- <a href="{{ route('tours.show', $tour) }}">--}}
{{-- <img src="{{ $tour->images->first()->path ?? asset('images/placeholder.jpg') }}" class="card-img-top"--}}
{{-- alt="{{ $tour->title }}">--}}
{{-- </a>--}}
{{-- <div class="card-body">--}}
{{-- <h5 class="card-title">--}}
{{-- <a href="{{ route('tours.show', $tour) }}">{{ $tour->title }}</a>--}}
{{-- </h5>--}}
{{-- <p class="card-text">{{ Str::limit($tour->description, 80) }}</p>--}}
{{-- <div class="d-flex justify-content-between">--}}
{{-- <span>{{ $tour->travelType->title ?? '—' }}</span>--}}
{{-- <strong>{{ number_format($tour->price) }} تومان</strong>--}}
{{-- </div>--}}
{{-- </div>--}}
{{--</div>--}}