fix:edit sidebar and tourcontroller
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\CommentStatus;
|
||||
use App\Enums\FlightStatus;
|
||||
use App\Enums\TourStatus;
|
||||
use App\Models\Tour;
|
||||
@@ -21,4 +22,22 @@ class TourController extends Controller
|
||||
return view('tours.index', compact('tours'));
|
||||
}
|
||||
|
||||
|
||||
public function show(Tour $tour)
|
||||
{
|
||||
abort_if($tour->status !== TourStatus::ENABLE->value, 404);
|
||||
|
||||
$tour->increment('views');
|
||||
|
||||
$tour->load([
|
||||
'file',
|
||||
'comments' => function ($query) {
|
||||
$query->where('status', CommentStatus::APPROVED)
|
||||
->with('user')
|
||||
->orderByDesc('created_at');
|
||||
},
|
||||
]);
|
||||
|
||||
return view('tours.show', compact('tour'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user