fix: update public tour functionality
This commit is contained in:
+14
-2
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Tour
|
* Class Tour
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int|null $travel_type_id
|
* @property int|null $travel_type_id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
@@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property int $status
|
* @property int $status
|
||||||
* @property Carbon $created_at
|
* @property Carbon $created_at
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
*
|
*
|
||||||
* @property TravelType|null $travelType
|
* @property TravelType|null $travelType
|
||||||
* @property Collection|Flight[] $flights
|
* @property Collection|Flight[] $flights
|
||||||
*
|
*
|
||||||
@@ -75,4 +75,16 @@ class Tour extends Model
|
|||||||
->withPivot('id')
|
->withPivot('id')
|
||||||
->withTimestamps();
|
->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 یعنی غیرفعال/پیشنویس
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,70 @@
|
|||||||
@props(['tour'])
|
<div class="banner _h-33vh _br-3 banner-animate banner-animate-mask-in">
|
||||||
|
|
||||||
<div class="card tour-card">
|
<div
|
||||||
<a href="{{ route('tours.show', $tour) }}">
|
class="banner-bg"
|
||||||
<img src="{{ $tour->images->first()->path ?? asset('images/placeholder.jpg') }}" class="card-img-top"
|
style="background-image:url('{{ asset($tour->image) }}');">
|
||||||
alt="{{ $tour->title }}">
|
</div>
|
||||||
|
|
||||||
|
<div class="banner-mask"></div>
|
||||||
|
|
||||||
|
<a
|
||||||
|
class="banner-link"
|
||||||
|
href="{{ route('tours.show', $tour) }}">
|
||||||
</a>
|
</a>
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">
|
<div class="banner-caption _pt-120 banner-caption-bottom banner-caption-grad">
|
||||||
<a href="{{ route('tours.show', $tour) }}">{{ $tour->title }}</a>
|
|
||||||
|
<h5 class="banner-title">
|
||||||
|
{{ $tour->title }}
|
||||||
</h5>
|
</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>
|
</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>--}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user