Files
intaleq_v2/app/Models/Passenger.php
2026-04-22 21:59:56 +03:00

57 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Passenger extends Model
{
protected $connection = 'primary';
protected $table = 'passengers';
protected $primaryKey = 'id';
protected $keyType = 'string';
public $incrementing = false;
public $timestamps = true;
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'id', 'phone', 'email', 'password', 'gender', 'status',
'birthdate', 'site', 'first_name', 'last_name', 'sosPhone',
'education', 'employmentType', 'maritalStatus',
'api_key', 'api_secret',
];
protected $hidden = ['password', 'api_secret'];
public const ENCRYPTED_FIELDS = [
'first_name', 'last_name', 'phone', 'gender', 'email', 'birthdate',
];
public function token()
{
return $this->hasOne(PassengerToken::class, 'passengerID', 'id');
}
public function wallet()
{
return $this->hasMany(PassengerWallet::class, 'passenger_id', 'id');
}
public function rides()
{
return $this->hasMany(Ride::class, 'passenger_id', 'id');
}
public function ratings()
{
return $this->hasMany(RatingPassenger::class, 'passenger_id', 'id');
}
public function scopeActive($query)
{
return $query->where('status', 'notDeleted');
}
}