2018-08-23 13:11:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Customer\Repositories;
|
|
|
|
|
|
|
|
|
|
use Webkul\Core\Eloquent\Repository;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Customer Reposotory
|
|
|
|
|
*
|
|
|
|
|
* @author Prashant Singh <prashant.singh852@webkul.com>
|
|
|
|
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class CustomerAddressRepository extends Repository
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Specify Model class name
|
|
|
|
|
*
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function model()
|
|
|
|
|
{
|
|
|
|
|
return 'Webkul\Customer\Models\CustomersAddress';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function create(array $data)
|
|
|
|
|
{
|
|
|
|
|
$address = $this->model->create($data);
|
|
|
|
|
|
|
|
|
|
return $address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @param $id
|
|
|
|
|
* @param string $attribute
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function update(array $data, $id, $attribute = "id")
|
|
|
|
|
{
|
2018-08-24 05:18:53 +00:00
|
|
|
$address = $this->findOneByField('customer_id', $id);
|
2018-08-23 13:11:56 +00:00
|
|
|
|
|
|
|
|
$address->update($data);
|
|
|
|
|
|
|
|
|
|
return $address;
|
|
|
|
|
}
|
|
|
|
|
}
|