fix: regenerate models and add database

This commit is contained in:
2026-08-16 08:06:57 +03:30
parent 8fa8d82c29
commit ff69c76dc4
11 changed files with 264 additions and 59 deletions
@@ -9,7 +9,7 @@ class RegisterController extends Controller
{ {
public function index() public function index()
{ {
return view('auth.register'); return view('auth.register');
} }
public function post() public function post()
+1 -1
View File
@@ -37,6 +37,6 @@ class Airport extends Model
public function flights() public function flights()
{ {
return $this->hasMany(Flight::class, 'deprature_airport_id'); return $this->hasMany(Flight::class, 'departure_airport_id');
} }
} }
+7 -14
View File
@@ -7,7 +7,6 @@
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
@@ -15,8 +14,8 @@ use Illuminate\Database\Eloquent\Model;
* *
* @property int $id * @property int $id
* @property int $user_id * @property int $user_id
* @property int $flight_id * @property int|null $flight_id
* @property int $tour_date_id * @property int|null $tour_date_id
* @property int $adult_count * @property int $adult_count
* @property int $child_count * @property int $child_count
* @property int $total_price * @property int $total_price
@@ -25,10 +24,9 @@ use Illuminate\Database\Eloquent\Model;
* @property int $status * @property int $status
* @property Carbon $updated_at * @property Carbon $updated_at
* *
* @property Booking $booking * @property User $user
* @property Flight $flight * @property Flight|null $flight
* @property TourDate $tourDate * @property TourDate|null $tourDate
* @property Collection|Booking[] $bookings
* *
* @package App\Models * @package App\Models
*/ */
@@ -58,9 +56,9 @@ class Booking extends Model
'status' 'status'
]; ];
public function booking() public function user()
{ {
return $this->belongsTo(Booking::class, 'user_id'); return $this->belongsTo(User::class);
} }
public function flight() public function flight()
@@ -72,9 +70,4 @@ class Booking extends Model
{ {
return $this->belongsTo(TourDate::class); return $this->belongsTo(TourDate::class);
} }
public function bookings()
{
return $this->hasMany(Booking::class, 'user_id');
}
} }
+48
View File
@@ -0,0 +1,48 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class City
*
* @property int $id
* @property int $province_id
* @property string $name
*
* @property Province $province
* @property Collection|User[] $users
*
* @package App\Models
*/
class City extends Model
{
protected $table = 'cities';
public $timestamps = false;
public static $snakeAttributes = false;
protected $casts = [
'province_id' => 'int'
];
protected $fillable = [
'province_id',
'name'
];
public function province()
{
return $this->belongsTo(Province::class);
}
public function users()
{
return $this->hasMany(User::class);
}
}
+22 -1
View File
@@ -14,10 +14,16 @@ use Illuminate\Database\Eloquent\Model;
* *
* @property int $id * @property int $id
* @property int $user_id * @property int $user_id
* @property int|null $flight_id
* @property int|null $tour_id
* @property string $comment * @property string $comment
* @property int|null $rating
* @property int $status * @property int $status
* @property Carbon $created_at * @property Carbon $created_at
* @property Carbon|null $updated_at
* *
* @property Flight|null $flight
* @property Tour|null $tour
* @property User $user * @property User $user
* *
* @package App\Models * @package App\Models
@@ -25,20 +31,35 @@ use Illuminate\Database\Eloquent\Model;
class Comment extends Model class Comment extends Model
{ {
protected $table = 'comments'; protected $table = 'comments';
public $timestamps = false;
public static $snakeAttributes = false; public static $snakeAttributes = false;
protected $casts = [ protected $casts = [
'user_id' => 'int', 'user_id' => 'int',
'flight_id' => 'int',
'tour_id' => 'int',
'rating' => 'int',
'status' => 'int' 'status' => 'int'
]; ];
protected $fillable = [ protected $fillable = [
'user_id', 'user_id',
'flight_id',
'tour_id',
'comment', 'comment',
'rating',
'status' 'status'
]; ];
public function flight()
{
return $this->belongsTo(Flight::class);
}
public function tour()
{
return $this->belongsTo(Tour::class);
}
public function user() public function user()
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);
+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Favorite
*
* @property int $id
* @property int $user_id
* @property int|null $flight_id
* @property int|null $tour_id
* @property Carbon|null $created_at
*
* @property Flight|null $flight
* @property Tour|null $tour
* @property User $user
*
* @package App\Models
*/
class Favorite extends Model
{
protected $table = 'favorites';
public $timestamps = false;
public static $snakeAttributes = false;
protected $casts = [
'user_id' => 'int',
'flight_id' => 'int',
'tour_id' => 'int'
];
protected $fillable = [
'user_id',
'flight_id',
'tour_id'
];
public function flight()
{
return $this->belongsTo(Flight::class);
}
public function tour()
{
return $this->belongsTo(Tour::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
}
+25 -15
View File
@@ -14,16 +14,15 @@ use Illuminate\Database\Eloquent\Model;
* Class Flight * Class Flight
* *
* @property int $id * @property int $id
* @property int $arrival_aiport_id
* @property int $departure_airport_id
* @property int $airline_id
* @property int $file_id
* @property string $title * @property string $title
* @property string $summary * @property string $summary
* @property int $arrival_aiport_id
* @property int $file_id
* @property int $flight_type * @property int $flight_type
* @property int $departure_time * @property Carbon $departure_time
* @property float $price * @property float $price
* @property int $deprature_airport_id
* @property string $destination
* @property int $airline_id
* @property int $capacity * @property int $capacity
* @property int $status * @property int $status
* @property Carbon $created_at * @property Carbon $created_at
@@ -33,6 +32,8 @@ use Illuminate\Database\Eloquent\Model;
* @property File $file * @property File $file
* @property Airport $airport * @property Airport $airport
* @property Collection|Booking[] $bookings * @property Collection|Booking[] $bookings
* @property Collection|Comment[] $comments
* @property Collection|Favorite[] $favorites
* *
* @package App\Models * @package App\Models
*/ */
@@ -43,27 +44,26 @@ class Flight extends Model
protected $casts = [ protected $casts = [
'arrival_aiport_id' => 'int', 'arrival_aiport_id' => 'int',
'departure_airport_id' => 'int',
'airline_id' => 'int',
'file_id' => 'int', 'file_id' => 'int',
'flight_type' => 'int', 'flight_type' => 'int',
'departure_time' => 'int', 'departure_time' => 'datetime',
'price' => 'float', 'price' => 'float',
'deprature_airport_id' => 'int',
'airline_id' => 'int',
'capacity' => 'int', 'capacity' => 'int',
'status' => 'int' 'status' => 'int'
]; ];
protected $fillable = [ protected $fillable = [
'arrival_aiport_id',
'departure_airport_id',
'airline_id',
'file_id',
'title', 'title',
'summary', 'summary',
'arrival_aiport_id',
'file_id',
'flight_type', 'flight_type',
'departure_time', 'departure_time',
'price', 'price',
'deprature_airport_id',
'destination',
'airline_id',
'capacity', 'capacity',
'status' 'status'
]; ];
@@ -80,11 +80,21 @@ class Flight extends Model
public function airport() public function airport()
{ {
return $this->belongsTo(Airport::class, 'deprature_airport_id'); return $this->belongsTo(Airport::class, 'departure_airport_id');
} }
public function bookings() public function bookings()
{ {
return $this->hasMany(Booking::class); return $this->hasMany(Booking::class);
} }
public function comments()
{
return $this->hasMany(Comment::class);
}
public function favorites()
{
return $this->hasMany(Favorite::class);
}
} }
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Province
*
* @property int $id
* @property string $name
*
* @property Collection|City[] $cities
* @property Collection|User[] $users
*
* @package App\Models
*/
class Province extends Model
{
protected $table = 'provinces';
public $timestamps = false;
public static $snakeAttributes = false;
protected $fillable = [
'name'
];
public function cities()
{
return $this->hasMany(City::class);
}
public function users()
{
return $this->hasMany(User::class);
}
}
+12
View File
@@ -26,6 +26,8 @@ use Illuminate\Database\Eloquent\Model;
* @property Carbon $updated_at * @property Carbon $updated_at
* *
* @property File $file * @property File $file
* @property Collection|Comment[] $comments
* @property Collection|Favorite[] $favorites
* @property Collection|TourDate[] $tourDates * @property Collection|TourDate[] $tourDates
* *
* @package App\Models * @package App\Models
@@ -57,6 +59,16 @@ class Tour extends Model
return $this->belongsTo(File::class); return $this->belongsTo(File::class);
} }
public function comments()
{
return $this->hasMany(Comment::class);
}
public function favorites()
{
return $this->hasMany(Favorite::class);
}
public function tourDates() public function tourDates()
{ {
return $this->hasMany(TourDate::class); return $this->hasMany(TourDate::class);
+37 -17
View File
@@ -10,11 +10,10 @@ use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticated ;
/** /**
* Class User * Class User
* *
* @property int $id * @property int $id
* @property string $first_name * @property string $first_name
* @property string $last_name * @property string $last_name
@@ -27,32 +26,35 @@ use Illuminate\Foundation\Auth\User as Authenticated ;
* @property int|null $image_id * @property int|null $image_id
* @property string $username * @property string $username
* @property string $password * @property string $password
* @property string $password_confirmation * @property int $province_id
* @property string $user_province * @property int $city_id
* @property string $user_city
* @property int|null $status * @property int|null $status
* @property Carbon $created_at * @property Carbon $created_at
* @property Carbon $updatet_at * @property Carbon $updated_at
* @property string $deleted_at * @property string|null $deleted_at
* *
* @property File|null $file * @property File|null $file
* @property City $city
* @property Province $province
* @property Collection|Booking[] $bookings
* @property Collection|Comment[] $comments * @property Collection|Comment[] $comments
* @property Collection|Favorite[] $favorites
* *
* @package App\Models * @package App\Models
*/ */
class User extends Authenticated class User extends Model
{ {
use SoftDeletes; use SoftDeletes;
protected $table = 'users'; protected $table = 'users';
public $timestamps = false;
public static $snakeAttributes = false; public static $snakeAttributes = false;
protected $casts = [ protected $casts = [
'gender' => 'int', 'gender' => 'int',
'marital_status' => 'int', 'marital_status' => 'int',
'image_id' => 'int', 'image_id' => 'int',
'status' => 'int', 'province_id' => 'int',
'updatet_at' => 'datetime' 'city_id' => 'int',
'status' => 'int'
]; ];
protected $hidden = [ protected $hidden = [
@@ -71,11 +73,9 @@ class User extends Authenticated
'image_id', 'image_id',
'username', 'username',
'password', 'password',
'password_confirmation', 'province_id',
'user_province', 'city_id',
'user_city', 'status'
'status',
'updatet_at'
]; ];
public function file() public function file()
@@ -83,8 +83,28 @@ class User extends Authenticated
return $this->belongsTo(File::class, 'image_id'); return $this->belongsTo(File::class, 'image_id');
} }
public function city()
{
return $this->belongsTo(City::class);
}
public function province()
{
return $this->belongsTo(Province::class);
}
public function bookings()
{
return $this->hasMany(Booking::class);
}
public function comments() public function comments()
{ {
return $this->hasMany(Comment::class); return $this->hasMany(Comment::class);
} }
public function favorites()
{
return $this->hasMany(Favorite::class);
}
} }
+10 -10
View File
@@ -5,17 +5,17 @@
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-md-7"> <div class="col-md-7">
<div class="header-top-left"> <div class="header-top-left">
<div class="top-social"> {{-- <div class="top-social">--}}
<a href="#"><i class="fab fa-facebook-f"></i></a> {{-- <a href="#"><i class="fab fa-facebook-f"></i></a>--}}
<a href="#"><i class="fab fa-twitter"></i></a> {{-- <a href="#"><i class="fab fa-twitter"></i></a>--}}
<a href="#"><i class="fab fa-instagram"></i></a> {{-- <a href="#"><i class="fab fa-instagram"></i></a>--}}
<a href="#"><i class="fab fa-linkedin-in"></i></a> {{-- <a href="#"><i class="fab fa-linkedin-in"></i></a>--}}
</div> {{-- </div>--}}
<div class="top-contact-info"> <div class="top-contact-info">
<ul> {{-- <ul>--}}
<li><a href="tel:+21234567897"><i class="far fa-phone-arrow-down-left"></i>0912345678</a></li> {{-- <li><a href="tel:+21234567897"><i class="far fa-phone-arrow-down-left"></i>0912345678</a></li>--}}
<li><a href="/cdn-cgi/l/email-protection#7b12151d143b1e031a160b171e55181416"><i class="far fa-envelopes"></i><span class="__cf_email__" data-cfemail="e0898e868fa08598818d908c85ce838f8d">[ایمیل&#160;محفوظ]</span></a></li> {{-- <li><a href="/cdn-cgi/l/email-protection#7b12151d143b1e031a160b171e55181416"><i class="far fa-envelopes"></i><span class="__cf_email__" data-cfemail="e0898e868fa08598818d908c85ce838f8d">[ایمیل&#160;محفوظ]</span></a></li>--}}
</ul> {{-- </ul>--}}
</div> </div>
</div> </div>
</div> </div>