mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 05:23:58 +00:00
59 lines
1.9 KiB
PHP
59 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Processors;
|
|
|
|
use App\Classes\Modules\Companies\DataTransferObjects\CompanyInfoObject;
|
|
use App\Classes\Modules\Companies\Services\CreatesCompanyInfo;
|
|
use App\Classes\Modules\Companies\Standards\Rules\CanCreateCompanyInfo;
|
|
use App\Models\Company;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CreateCompanyInfoProcessor
|
|
{
|
|
/** @var CanCreateCompanyInfo */
|
|
private $canCreateCompanyInfo;
|
|
|
|
/** @var CreatesCompanyInfo */
|
|
private $createsCompanyInfo;
|
|
|
|
/**
|
|
* CreateUserProcessor constructor.
|
|
* @param CanCreateCompanyInfo $canCreateCompany
|
|
* @param CreatesCompany $createsCompany
|
|
*/
|
|
public function __construct(CanCreateCompanyInfo $canCreateCompanyInfo, CreatesCompanyInfo $createsCompanyInfo)
|
|
{
|
|
$this->canCreateCompanyInfo = $canCreateCompanyInfo;
|
|
$this->createsCompanyInfo = $createsCompanyInfo;
|
|
}
|
|
|
|
/**
|
|
* @param Company $company
|
|
* @param Request $request
|
|
* @return Model
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function execute(Company $company, Request $request): Model
|
|
{
|
|
$companyInfo_object = new CompanyInfoObject(
|
|
$company,
|
|
$request->input('unified_social_credit_identifier'),
|
|
$request->input('business_registration_number'),
|
|
$request->input('type'),
|
|
$request->input('legal_representative'),
|
|
$request->input('last_year_of_inspection'),
|
|
$request->input('date_of_establishment'),
|
|
$request->input('operation_period')
|
|
);
|
|
|
|
$this->canCreateCompanyInfo->passes($companyInfo_object);
|
|
|
|
$companyInfo = $this->createsCompanyInfo->execute($companyInfo_object);
|
|
|
|
return $companyInfo;
|
|
}
|
|
}
|