added setting for user
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class CustomerSpecialPricePackage extends Model
|
||||
{
|
||||
protected $table = 'customer_special_price_packages';
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'profit_buy',
|
||||
'profit_sell',
|
||||
'show_product',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'profit_buy' => 'integer',
|
||||
'profit_sell' => 'integer',
|
||||
'show_product' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function customers(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Customer::class,
|
||||
'customer_special_price_package_customer',
|
||||
'package_id',
|
||||
'customer_id'
|
||||
)->withPivot([]);
|
||||
}
|
||||
|
||||
public function products(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Product::class,
|
||||
'customer_special_price_package_product',
|
||||
'package_id',
|
||||
'product_id'
|
||||
)->withPivot([]);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user