23.11 Upload to live

This commit is contained in:
Kevin Adametz 2019-11-23 15:02:41 +01:00
parent 8cae2f92a4
commit 8ebdacec98
80 changed files with 7320 additions and 3937 deletions

View file

@ -34,6 +34,15 @@ use Cviebrock\EloquentSluggable\Sluggable;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category query()
* @property string|null $headline
* @property int|null $headline_image_id
* @property array|null $trans_headline
* @property-read int|null $childrens_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Image[] $image
* @property-read int|null $image_count
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadline($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereHeadlineImageId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTransHeadline($value)
*/
class Category extends Model
{
@ -41,10 +50,10 @@ class Category extends Model
protected $table = 'categories';
protected $casts = ['trans_name' => 'array'];
protected $casts = ['trans_name' => 'array', 'trans_headline' => 'array'];
protected $fillable = [
'parent_id', 'name', 'pos', 'active',
'parent_id', 'name', 'headline', 'pos', 'active',
];
public function sluggable()
@ -66,10 +75,15 @@ class Category extends Model
return $this->hasMany('App\Models\Category', 'parent_id', 'id');
}
public function product_categories()
{
return $this->hasMany('App\Models\ProductCategory', 'category_id', 'id');
}
public function iq_image()
{
return $this->belongsTo('App\Models\IqImage', 'headline_image_id');
}
public function setPosAttribute($value){
@ -95,6 +109,7 @@ class Category extends Model
if (!empty($this->{$key}[$lang])) {
return $this->{$key}[$lang];
}
return "";
}
public function getTranNames()
@ -106,4 +121,13 @@ class Category extends Model
return rtrim($ret, ', ');
}
public function getTranHeadlines()
{
$ret = "";
foreach ((array) $this->trans_headline as $value){
$ret .= $value.', ';
}
return rtrim($ret, ', ');
}
}