数据多语言
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class LocationAr extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'locations_ar';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function vehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleAr::class, 'locations_id', 'id');
|
||||
}
|
||||
/**
|
||||
* 目的地关联
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function finalVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleAr::class, 'final_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FBO vehicles for the location.
|
||||
*/
|
||||
public function fboVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleAr::class, 'fbo_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include locations that have vehicles.
|
||||
*/
|
||||
public function scopeHasVehicles($query)
|
||||
{
|
||||
return $query->whereHas('vehicles_ar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class LocationEn extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'locations_en';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function vehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleEn::class, 'locations_id', 'id');
|
||||
}
|
||||
/**
|
||||
* 目的地关联
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function finalVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleEn::class, 'final_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FBO vehicles for the location.
|
||||
*/
|
||||
public function fboVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleEn::class, 'fbo_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include locations that have vehicles.
|
||||
*/
|
||||
public function scopeHasVehicles($query)
|
||||
{
|
||||
return $query->whereHas('vehicles_en');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class LocationRu extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'locations_ru';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function vehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleRu::class, 'locations_id', 'id');
|
||||
}
|
||||
/**
|
||||
* 目的地关联
|
||||
* Get the vehicles for the location.
|
||||
*/
|
||||
public function finalVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleRu::class, 'final_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the FBO vehicles for the location.
|
||||
*/
|
||||
public function fboVehicles()
|
||||
{
|
||||
return $this->hasMany(VehicleRu::class, 'fbo_locations_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include locations that have vehicles.
|
||||
*/
|
||||
public function scopeHasVehicles($query)
|
||||
{
|
||||
return $query->whereHas('vehicles_ru');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class VehicleAr extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'vehicles_ar';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function location()
|
||||
{
|
||||
return $this->belongsTo(LocationAr::class, 'locations_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function finalLocation()
|
||||
{
|
||||
return $this->belongsTo(LocationAr::class, 'final_locations_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class VehicleEn extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'vehicles_en';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function location()
|
||||
{
|
||||
return $this->belongsTo(LocationEn::class, 'locations_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function finalLocation()
|
||||
{
|
||||
return $this->belongsTo(LocationEn::class, 'final_locations_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
class VehicleRu extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'vehicles_ru';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function location()
|
||||
{
|
||||
return $this->belongsTo(LocationRu::class, 'locations_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location that owns the vehicle.
|
||||
*/
|
||||
public function finalLocation()
|
||||
{
|
||||
return $this->belongsTo(LocationRu::class, 'final_locations_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user