'int', 'pick_up' => 'bool', 'active' => 'bool', 'featured' => 'array', 'trans' => 'array', ]; protected $dates = [ 'active_date' ]; protected $fillable = [ 'user_id', 'url', 'name', 'description', 'about_you', 'user_address', 'trans', 'pick_up', 'active', 'active_date', 'featured' ]; public function user() { return $this->belongsTo(User::class); } public function getUrlPreview() { return $this->url ? config('app.shop_url')."/".$this->url : ""; } public function getLang($key, $default = true) { $lang = \App::getLocale(); if ($lang == 'de') { return $this->{$key}; } return $this->getTrans($key, $lang, $default); } public function getTrans($key, $lang, $default = true) { if ($lang == 'de') { return $this->{$key}; } if(!empty($this->trans[$lang][$key])){ return $this->trans[$lang][$key]; } if($default){ return !empty($this->{$key}) ? $this->{$key} : ''; } return ""; } public function isActive(){ if($this->active){ return true; } return false; } public function getSubdomain(){ return ""; } }