This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -37,10 +37,8 @@ use PHPUnit\Framework\Constraint\Count;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereTrans($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereUpdatedAt($value)
* @property string|null $trans_name
* @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
@ -60,6 +58,8 @@ use PHPUnit\Framework\Constraint\Count;
* @property bool|null $supply_country
* @method static \Illuminate\Database\Eloquent\Builder|Country whereEuCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|Country whereSupplyCountry($value)
* @property bool|null $translate
* @method static \Illuminate\Database\Eloquent\Builder|Country whereTranslate($value)
* @mixin \Eloquent
*/
class Country extends Model
@ -68,19 +68,19 @@ class Country extends Model
protected $casts = [
'switch' => 'bool',
'translate' => 'bool',
'supply_country' => 'bool',
'eu_country' => 'bool',
'own_eur' => 'bool',
'currency' => 'bool',
'currency_calc' => 'bool',
'trans_name' => 'array',
'attr' => 'array'
];
protected $fillable = [
'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru',
'supply_country', 'eu_country', 'switch', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
'active', 'trans_name', 'attr',
'supply_country', 'eu_country', 'switch', 'translate', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
'active', 'attr',
];
public function country_prices()
@ -92,7 +92,6 @@ class Country extends Model
if(!$lang){
$lang = \App::getLocale();
}
if($lang === 'de'){
return $this->de;
@ -114,22 +113,10 @@ class Country extends Model
}
//search by trans
if($val = $this->getTrans('name', $lang)){
return $val;
}
return $this->de;
}
public function getTrans($key, $lang)
{
$key = 'trans_' . $key;
if (!empty($this->{$key}[$lang])) {
return $this->{$key}[$lang];
}
return "";
}
public function getAttrByKey($key)
{
$name = 'attr';