feat:complete tours for admin side
This commit is contained in:
@@ -5,5 +5,6 @@ namespace App\Enums;
|
||||
enum TourStatus:int
|
||||
{
|
||||
case DISABLE = 0;
|
||||
|
||||
case ENABLE = 1;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class TourController extends Controller
|
||||
|
||||
public function show(Tour $tour)
|
||||
{
|
||||
abort_if($tour->status !== TourStatus::ENABLE->value, 404);
|
||||
abort_if($tour->status !== TourStatus::ENABLE, 404);
|
||||
|
||||
$tour->increment('views');
|
||||
|
||||
|
||||
+16
-11
@@ -6,6 +6,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\TourStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Database\Query\Builder;
|
||||
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||
@@ -37,7 +38,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Tour extends Model
|
||||
{
|
||||
protected $table = 'tours';
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
public static $snakeAttributes = false;
|
||||
|
||||
@@ -45,24 +46,28 @@ class Tour extends Model
|
||||
'file_id' => 'int',
|
||||
'duration' => 'int',
|
||||
'price' => 'int',
|
||||
'status' => 'int',
|
||||
'status' => TourStatus::class,
|
||||
'created_at' => 'datetime',
|
||||
'views' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'summary',
|
||||
'descriptions',
|
||||
'file_id',
|
||||
'origin',
|
||||
'destination',
|
||||
'duration',
|
||||
'title',
|
||||
'summary',
|
||||
'descriptions',
|
||||
'file_id',
|
||||
'origin',
|
||||
'destination',
|
||||
'duration',
|
||||
'price',
|
||||
'views',
|
||||
'status',
|
||||
'created_at'
|
||||
];
|
||||
'created_at',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'capacity',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function file()
|
||||
{
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\TourDateStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class TourDate
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $tour_id
|
||||
* @property Carbon $start_date
|
||||
@@ -22,7 +23,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property int $status
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
*
|
||||
* @property Tour $tour
|
||||
* @property Collection|Booking[] $bookings
|
||||
*
|
||||
@@ -39,7 +40,7 @@ class TourDate extends Model
|
||||
'end_date' => 'datetime',
|
||||
'price' => 'int',
|
||||
'capacity' => 'int',
|
||||
'status' => 'int'
|
||||
'status' => TourDateStatus::class,
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
||||
Reference in New Issue
Block a user