mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-24 23:13:56 +00:00
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Warehouses\Services;
|
|
|
|
|
|
use App\Classes\Modules\Warehouses\DataTransferObjects\WarehouseObject;
|
|
use App\Models\Warehouse;
|
|
|
|
class CreatesWarehouse
|
|
{
|
|
/** @var Warehouse */
|
|
private $repository;
|
|
|
|
/**
|
|
* CreatesWarehouse constructor.
|
|
* @param Warehouse $repository
|
|
*/
|
|
public function __construct(Warehouse $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
public function execute(WarehouseObject $warehouse){
|
|
|
|
$this->repository->name = $warehouse->getName();
|
|
$this->repository->email = $warehouse->getEmail();
|
|
$this->repository->street_one = $warehouse->getStreetOne();
|
|
$this->repository->street_two = $warehouse->getStreetTwo();
|
|
$this->repository->city = $warehouse->getCity();
|
|
$this->repository->state = $warehouse->getState();
|
|
$this->repository->post_code = $warehouse->getPostCode();
|
|
$this->repository->country = $warehouse->getCountry();
|
|
$this->repository->save();
|
|
|
|
return $this->repository;
|
|
|
|
}
|
|
|
|
} |