/**
  * Create a Part in the event store as well as in the read model
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $partId = PartId::generate();
     $manufacturerId = ManufacturerId::generate();
     $command = new ManufacturePartCommand($partId, $manufacturerId, $request->get('manufacturer-name'));
     $this->commandBus->dispatch($command);
     return Redirect::route('parts.index')->with('success', 'Part successfully created.');
 }
 /** @test */
 public function should_return_id_as_string()
 {
     $id = ManufacturerId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', $id->toString());
     $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', (string) $id);
 }
 /**
  * @test
  */
 public function it_can_manufacture()
 {
     $partId = PartId::generate();
     $manufacturerId = ManufacturerId::generate();
     $this->scenario->withAggregateId($partId->toString())->given([])->when(new ManufacturePartCommand($partId, $manufacturerId, 'Acme, Inc'))->then([new PartWasManufacturedEvent($partId, $manufacturerId, 'Acme, Inc')]);
 }
 /**
  * @return \Modules\Core\Domain\Identifier
  */
 private function makeManufacturerId()
 {
     $id = ManufacturerId::generate();
     return ManufacturerId::fromString($id);
 }