Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:39:21 +02:00
parent 6167273a48
commit 9b54eb0512
348 changed files with 34535 additions and 5774 deletions

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Services\Util;
use Illuminate\Database\Eloquent\Model;
/**
@ -25,39 +26,66 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereTransName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereUpdatedAt($value)
* @mixin \Eloquent
* @property string|null $slug
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute query()
* @property-read int|null $childrens_count
* @property int $attribute_type_id
* @property string|null $value
* @property-read \App\Models\AttributeType $attribute_type
* @method static \Illuminate\Database\Eloquent\Builder|Attribute whereAttributeTypeId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Attribute whereValue($value)
* @mixin \Eloquent
*/
class Attribute extends Model
{
protected $table = 'attributes';
protected $casts = ['trans_name' => 'array'];
protected $fillable = [
'parent_id', 'name', 'pos', 'active',
protected $casts = [
'parent_id' => 'int',
'pos' => 'int',
'active' => 'bool',
'trans_name' => 'array',
];
protected $fillable = [
'parent_id',
'attribute_type_id',
'name',
'value',
'trans_name',
'pos',
'active',
'slug'
];
public function attribute_type()
{
return $this->belongsTo(AttributeType::class, 'attribute_type_id');
}
public function parent()
{
return $this->belongsTo('App\Models\Attribute', 'parent_id');
return $this->belongsTo(Attribute::class, 'parent_id');
}
public function childrens()
{
return $this->hasMany('App\Models\Attribute', 'parent_id', 'id');
return $this->hasMany(Attribute::class, 'parent_id', 'id');
}
public function setPosAttribute($value){
$this->attributes['pos'] = is_numeric($value) ? $value : null;
}
public function getFormattedValue()
{
// return isset($this->attributes['value']) ? Util::formatNumber($this->attributes['value']) : "";
}
public function getLang($key)
{
$lang = \App::getLocale();