Customers Add+Edit, API WP
This commit is contained in:
parent
dc63fa9fb2
commit
75a0f9a38a
120 changed files with 11894 additions and 6134 deletions
|
|
@ -42,17 +42,46 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @property array|null $attr
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereAttr($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTransName($value)
|
||||
* @property bool|null $switch
|
||||
* @property bool|null $own_eur
|
||||
* @property bool|null $currency
|
||||
* @property string|null $currency_unit
|
||||
* @property bool|null $currency_calc
|
||||
* @property float|null $currency_faktor
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrency($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyCalc($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyFaktor($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereOwnEur($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereSwitch($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CountryPrice[] $country_prices
|
||||
* @property-read int|null $country_prices_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyUnit($value)
|
||||
*/
|
||||
class Country extends Model
|
||||
{
|
||||
protected $table = 'countries';
|
||||
|
||||
protected $casts = ['trans_name' => 'array', 'attr' => 'array'];
|
||||
protected $casts = [
|
||||
'switch' => 'bool',
|
||||
'own_eur' => 'bool',
|
||||
'currency' => 'bool',
|
||||
'currency_calc' => 'bool',
|
||||
'trans_name' => 'array',
|
||||
'attr' => 'array'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru', 'active', 'trans_name', 'attr'
|
||||
'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru',
|
||||
'switch', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
|
||||
'active', 'trans_name', 'attr',
|
||||
];
|
||||
|
||||
public function country_prices()
|
||||
{
|
||||
return $this->hasMany(CountryPrice::class, 'country_id');
|
||||
}
|
||||
|
||||
public function getLocated($lang = false){
|
||||
|
||||
if(!$lang){
|
||||
|
|
@ -115,6 +144,17 @@ class Country extends Model
|
|||
return null;
|
||||
}
|
||||
|
||||
public static function getCountryIdByCodeOrOne($code){
|
||||
if($code == null){
|
||||
return 1;
|
||||
}
|
||||
$r = Country::where('code', '=', $code)->first();
|
||||
if($r){
|
||||
return $r->id;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function getCountryIdByPhone($phone){
|
||||
if($phone == null){
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue