Initial V2 commit
This commit is contained in:
56
app/Models/Passenger.php
Normal file
56
app/Models/Passenger.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user