Files
exchange-2.0/database/seeds/SegmentConstantsTableSeeder.php
T
omair saleh 05401f6bbc large commit
2021-03-11 13:06:40 +08:00

53 lines
1.6 KiB
PHP

<?php
use App\Classes\Modules\Currencies\Services\FetchesCurrency;
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
use App\Classes\Modules\Segments\Services\CreatesConstant;
use App\Classes\Modules\Segments\Services\FetchesSegment;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use Illuminate\Database\Seeder;
class SegmentConstantsTableSeeder extends Seeder
{
/** @var FetchesCurrency */
private $fetchesCurrency;
/** @var FetchesSegment */
private $fetchesSegment;
/** @var CreatesConstant */
private $createsSegmentConstant;
/**
* SegmentConstantsTableSeeder constructor.
* @param FetchesCurrency $fetchesCurrency
* @param FetchesSegment $fetchesSegment
* @param CreatesConstant $createsSegmentConstant
*/
public function __construct(FetchesCurrency $fetchesCurrency, FetchesSegment $fetchesSegment, CreatesConstant $createsSegmentConstant)
{
$this->fetchesCurrency = $fetchesCurrency;
$this->fetchesSegment = $fetchesSegment;
$this->createsSegmentConstant = $createsSegmentConstant;
}
/**
* Run the database seeds.
*
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function run()
{
$object = new ConstantObject('System Primary Currency',
SegmentConstants::SYSTEM_PRIMARY_CURRENCY,
['id' => $this->fetchesCurrency->execute(['name' => country('my')->getName()])->id]);
$this->createsSegmentConstant->execute($this->fetchesSegment->execute(['Standard Segment']), $object);
}
}