git commit "add favorites display with polymorphic relation"
This commit is contained in:
@@ -93,74 +93,40 @@
|
||||
|
||||
@foreach($favorites as $favorite)
|
||||
|
||||
<div class="col-md-6">
|
||||
@if($favorite->favoritable)
|
||||
|
||||
<div class="theme-search-results-item">
|
||||
@if($favorite->favoritable_type == 'App\Models\Tour')
|
||||
|
||||
<div class="theme-search-results-item-img-wrap">
|
||||
|
||||
@if($favorite->tour->image)
|
||||
<img
|
||||
class="theme-search-results-item-img"
|
||||
src="{{ asset('uploads/tours/' . $favorite->tour->image) }}"
|
||||
alt="{{ $favorite->tour->title }}"
|
||||
>
|
||||
@else
|
||||
<img
|
||||
class="theme-search-results-item-img"
|
||||
src="{{ asset('img/placeholder.jpg') }}"
|
||||
alt="{{ $favorite->tour->title }}"
|
||||
>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="theme-search-results-item-title">
|
||||
<div class="card mb-3 p-3">
|
||||
|
||||
<h3>
|
||||
{{ $favorite->tour->title }}
|
||||
{{ $favorite->favoritable->title }}
|
||||
</h3>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="theme-search-results-item-actions">
|
||||
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-primary"
|
||||
>
|
||||
مشاهده تور
|
||||
</a>
|
||||
|
||||
|
||||
<form
|
||||
action="{{ route('users.favorite.destroy', $favorite) }}"
|
||||
method="POST"
|
||||
style="display:inline-block;"
|
||||
>
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-danger"
|
||||
>
|
||||
<i class="fa fa-heart-o"></i>
|
||||
حذف
|
||||
</button>
|
||||
|
||||
</form>
|
||||
<img width="200"
|
||||
src="{{ asset($favorite->favoritable->image) }}">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@elseif($favorite->favoritable_type == 'App\Models\Flight')
|
||||
|
||||
<div class="card mb-3 p-3">
|
||||
|
||||
<h3>
|
||||
{{ $favorite->favoritable->airline }}
|
||||
</h3>
|
||||
|
||||
<img width="200"
|
||||
src="{{ asset($favorite->favoritable->image) }}">
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
Reference in New Issue
Block a user