git commit "add user reservations and complete profile features"

This commit is contained in:
2026-08-17 19:35:22 +03:30
parent ded7416302
commit 3055e42641
12 changed files with 829 additions and 0 deletions
+7
View File
@@ -76,6 +76,13 @@ class Flight extends Model
{
return $this->morphMany(Favorite::class, 'favoritable');
}
public function reservations()
{
return $this->morphMany(
Reservation::class,
'reservable'
);
}
#[Scope]
public function applySearch(Builder $query, array $filters): void
+60
View File
@@ -0,0 +1,60 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Reservation
*
* @property int $id
* @property int $user_id
* @property int $reservable_id
* @property string $reservable_type
* @property float $price
* @property string $status
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
*/
class Reservation extends Model
{
protected $table = 'reservations';
public static $snakeAttributes = false;
protected $casts = [
'user_id' => 'int',
'reservable_id' => 'int',
'price' => 'float',
];
protected $fillable = [
'user_id',
'reservable_id',
'reservable_type',
'price',
'status'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function reservable()
{
return $this->morphTo();
}
}
+4
View File
@@ -66,4 +66,8 @@ class Tour extends Model
{
return $this->morphMany(Favorite::class, 'favoritable');
}
public function reservations()
{
return $this->morphMany(Reservation::class, 'reservable');
}
}