Files
opensem/app/Repositories/Shop/CustomerSaleChannels.php
2025-02-15 12:12:42 +01:00

29 lines
653 B
PHP

<?php
namespace App\Repositories\Shop;
use App\Models\Shop\CustomerSaleChannel;
use App\Traits\Model\Basic;
class CustomerSaleChannels
{
use Basic;
public static function createByCustomer($customerId)
{
$customer = Customers::get($customerId);
return $customer->sale_channels()->sync(SaleChannels::getDefault());
}
public static function destroyByCustomerAndSaleChannel($customerId, $saleChannelId)
{
return CustomerSaleChannel::byCustomer($customerId)->bySaleChannel($saleChannelId)->delete();
}
public static function getModel()
{
return CustomerSaleChannel::query();
}
}