Product class optimisation
This commit is contained in:
@@ -96,7 +96,9 @@ class Product extends Model implements IDs
|
||||
public function translate()
|
||||
{
|
||||
return $this->hasOne(ProductTranslate::class)
|
||||
->where('language_id',(Auth::user() && Auth::user()->language_id) ? Auth::user()->language_id : config('site')->language_id);
|
||||
->where('language_id',(Auth::user() && Auth::user()->language_id)
|
||||
? Auth::user()->language_id
|
||||
: config('site')->language_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,11 +292,12 @@ class Product extends Model implements IDs
|
||||
/**
|
||||
* Suppliers product
|
||||
*
|
||||
* @return Model|null
|
||||
* @return Model
|
||||
* @todo make internal as other values off this attribute are used, not the model itself
|
||||
*/
|
||||
public function getSuppliedAttribute(): ?Model
|
||||
public function getSuppliedAttribute(): Model
|
||||
{
|
||||
return $this->type->supplied ? $this->type->supplied : NULL;
|
||||
return $this->type->supplied;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user