sarga/packages/Webkul/Customer/src/Repositories/CustomerGroupRepository.php

61 lines
1.2 KiB
PHP
Raw Normal View History

2018-09-11 04:11:48 +00:00
<?php
namespace Webkul\Customer\Repositories;
use Webkul\Core\Eloquent\Repository;
class CustomerGroupRepository extends Repository
{
/**
* Specify Model class name
*
* @return mixed
*/
function model()
{
2019-02-18 07:30:40 +00:00
return 'Webkul\Customer\Contracts\CustomerGroup';
2018-09-11 04:11:48 +00:00
}
/**
2020-03-05 05:34:57 +00:00
* @param array $data
* @return \Webkul\Customer\Contracts\CustomerGroup
2018-09-11 04:11:48 +00:00
*/
public function create(array $data)
{
$customer = $this->model->create($data);
return $customer;
}
/**
2020-03-05 13:37:08 +00:00
* @param array $data
* @param int $id
2020-03-05 05:34:57 +00:00
* @param string $id
* @return \Webkul\Customer\Contracts\CustomerGroup
2018-09-11 04:11:48 +00:00
*/
public function update(array $data, $id, $attribute = "id")
{
$customer = $this->find($id);
$customer->update($data);
return $customer;
}
/**
* Returns guest group.
*
* @return object
*/
public function getCustomerGuestGroup()
{
static $customerGuestGroup;
if ($customerGuestGroup) {
return $customerGuestGroup;
}
return $customerGuestGroup = $this->findOneByField('code', 'guest');
}
2018-09-11 04:11:48 +00:00
}