Actualizacuion de Rama Kquiroz
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
|
||||
protected $guarded = ['choice_attributes'];
|
||||
|
||||
protected $with = ['product_translations', 'taxes'];
|
||||
protected $with = ['product_translations', 'taxes', 'thumbnail'];
|
||||
|
||||
public function getTranslation($field = '', $lang = false)
|
||||
{
|
||||
@@ -74,6 +74,11 @@ class Product extends Model
|
||||
return $this->hasMany(AuctionProductBid::class);
|
||||
}
|
||||
|
||||
public function thumbnail()
|
||||
{
|
||||
return $this->belongsTo(Upload::class, 'thumbnail_img');
|
||||
}
|
||||
|
||||
public function scopePhysical($query)
|
||||
{
|
||||
return $query->where('digital', 0);
|
||||
@@ -83,4 +88,14 @@ class Product extends Model
|
||||
{
|
||||
return $query->where('digital', 1);
|
||||
}
|
||||
|
||||
public function carts()
|
||||
{
|
||||
return $this->hasMany(Cart::class);
|
||||
}
|
||||
|
||||
public function scopeIsApprovedPublished($query)
|
||||
{
|
||||
return $query->where('approved', '1')->where('published', 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user