sarga/packages/Webkul/Sales/src/Repositories/OrderItemRepository.php

43 lines
877 B
PHP
Raw Normal View History

<?php
namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
/**
* OrderItem Reposotory
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class OrderItemRepository extends Repository
{
/**
* Specify Model class name
*
* @return Mixed
*/
function model()
{
return 'Webkul\Sales\Contracts\OrderItem';
}
2018-10-05 06:18:58 +00:00
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
2018-10-05 11:59:43 +00:00
if(isset($data['product']) && $data['product']) {
2018-10-05 06:18:58 +00:00
$data['product_id'] = $data['product']->id;
$data['product_type'] = get_class($data['product']);
2018-10-05 11:59:43 +00:00
unset($data['product']);
2018-10-05 06:18:58 +00:00
}
return $this->model->create($data);
}
}