Fixes for deliveries vs sale_channels
This commit is contained in:
31
app/Models/Shop/CustomerDelivery.php
Normal file
31
app/Models/Shop/CustomerDelivery.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerDelivery extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_customer_deliveries';
|
||||
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function delivery()
|
||||
{
|
||||
return $this->belongsTo(Delivery::class);
|
||||
}
|
||||
|
||||
public function scopeByCustomer($query, $customer_id)
|
||||
{
|
||||
return $query->where($this->table . '.customer_id', $customer_id);
|
||||
}
|
||||
|
||||
public function scopeByDelivery($query, $customer_id)
|
||||
{
|
||||
return $query->where($this->table . '.delivery_id', $customer_id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user