minor fixes
This commit is contained in:
36
app/Models/Shop/CustomerSaleChannel.php
Normal file
36
app/Models/Shop/CustomerSaleChannel.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
|
||||
class CustomerSaleChannel extends Model
|
||||
{
|
||||
use SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $table = 'shop_customer_sale_channels';
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function sale_channel()
|
||||
{
|
||||
return $this->belongsTo(SaleChannel::class);
|
||||
}
|
||||
|
||||
public function scopeByCustomer($query, $customerId)
|
||||
{
|
||||
return $query->where($this->table.'.customer_id', $customerId);
|
||||
}
|
||||
|
||||
public function scopeBySaleChannel($query, $saleChannelId)
|
||||
{
|
||||
return $query->where($this->table.'.sale_channel_id', $saleChannelId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user