createEntityProcessor = $createEntityProcessor; $this->createEntitySignatureProcessor = $createEntitySignatureProcessor; } /** * Run the database seeds. * * @return void */ public function run() { $companies = [ [ 'id' => 1, //Reserve ID 'name' => 'CIEF SDN BHD', 'reference' => 'CIEF', 'type' => CompanyType::COMPANY_BUSINESS, 'status' => ApprovalStatus::APPROVED, ], [ 'name' => 'Guang Zhou', 'reference' => 'guangzhouwarehouse', 'type' => CompanyType::COMPANY_BUSINESS, 'status' => ApprovalStatus::APPROVED, ], [ 'name' => 'Yiwu', 'reference' => 'yiwuwarehouse', 'type' => CompanyType::COMPANY_BUSINESS, 'status' => ApprovalStatus::APPROVED, ] ]; if (!empty($companies)) { foreach ($companies as $company) { $unityEntity = $this->createEntityProcessor->execute($company['name']); $unityEntitySignature = $this->createEntitySignatureProcessor->execute($unityEntity->hash_id); $company = Company::create($company); $companyModule = [ 'company_id' => $company->id, 'type' => BusinessType::WAREHOUSE, 'status' => ApprovalStatus::APPROVED, 'unity_hash_id' => $unityEntity->hash_id, 'unity_signature' => $unityEntitySignature->hash_id, ]; if($company['reference']=='CIEF'){ $companyModule['id']= 1; //Reserve ID $companyModule['type']=BusinessType::FREIGHT_FORWARDER; } CompanyModule::create($companyModule); } } } }