116 lines
2.2 KiB
PHP
116 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\UserGender;
|
|
use App\Enums\UserMarital;
|
|
use App\Enums\UserStatus;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Foundation\Auth\User as Authenticate;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* Class User
|
|
*
|
|
* @property int $id
|
|
* @property string $first_name
|
|
* @property string $last_name
|
|
* @property int|null $file_id
|
|
* @property int|null $city_id
|
|
* @property int|null $province_id
|
|
* @property string $national_code
|
|
* @property int $gender
|
|
* @property int $marital_status
|
|
* @property string|null $spouse_name
|
|
* @property string $mobile
|
|
* @property string $email
|
|
* @property string $username
|
|
* @property string $password
|
|
* @property bool $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property string|null $deleted_at
|
|
*
|
|
* @property File|null $file
|
|
* @property Province|null $province
|
|
* @property City|null $city
|
|
* @property Collection|Booking[] $bookings
|
|
* @property Collection|Passenger[] $passengers
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class User extends Authenticate
|
|
{
|
|
use SoftDeletes;
|
|
protected $table = 'users';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'file_id' => 'int',
|
|
'city_id' => 'int',
|
|
'province_id' => 'int',
|
|
'gender' => UserGender::class,
|
|
'marital_status' => UserMarital::class,
|
|
'status' => UserStatus::class
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'first_name',
|
|
'last_name',
|
|
'file_id',
|
|
'city_id',
|
|
'province_id',
|
|
'national_code',
|
|
'gender',
|
|
'marital_status',
|
|
'spouse_name',
|
|
'mobile',
|
|
'email',
|
|
'username',
|
|
'password',
|
|
'status'
|
|
];
|
|
|
|
public function file()
|
|
{
|
|
return $this->belongsTo(File::class);
|
|
}
|
|
|
|
public function province()
|
|
{
|
|
return $this->belongsTo(Province::class);
|
|
}
|
|
|
|
public function city()
|
|
{
|
|
return $this->belongsTo(City::class);
|
|
}
|
|
|
|
public function bookings()
|
|
{
|
|
return $this->hasMany(Booking::class);
|
|
}
|
|
|
|
public function passengers()
|
|
{
|
|
return $this->hasMany(Passenger::class);
|
|
}
|
|
public function comments()
|
|
{
|
|
return $this->hasMany(Comment::class, 'user_id');
|
|
}
|
|
public function favorites()
|
|
{
|
|
return $this->hasMany(Favorite::class);
|
|
}
|
|
}
|