public function makeHandler($entity, $namespace)
 {
     if ($entity->commands) {
         $this->setupCommandSystem();
         $this->bag('ADD : App\\Providers\\BusServiceProvider::class to config/app.php');
         foreach ($this->types as $type) {
             $this->construct = '';
             $this->construct = '';
             $this->eventable = '';
             $this->type = $type;
             $this->stub = $this->getStub('Commands/' . $this->type . 'CommandHandler');
             $this->entity = $entity;
             $this->namespace = $namespace;
             $this->path = base_path() . '/app/' . $this->namespace . '/Handlers/Commands/' . $this->entity->name . '/' . $this->type . Utils::singularize($this->entity->name) . 'CommandHandler.php';
             $this->setImports();
             $this->setConstructor();
             $this->setEventable();
             $this->setPersister();
             $this->stub = $this->replaceInStub('__FIELDSLISFROMCOMMAND__', $this->makeFieldListSinglesFromCommand('command'), $this->stub);
             $this->setModelName();
             $this->setModelInstance();
             $this->setNameSpace();
             $this->writeFile();
             $this->bag('Created ' . $this->type . ' Handler for : ' . $entity->name);
         }
     }
 }
Beispiel #2
0
 public function setModelInstance($lowercase = false)
 {
     $this->bag('Setting model instance to: ' . Utils::singularize($this->entity->name));
     if ($lowercase) {
         $this->stub = $this->replaceInStub('__MODELINSTANCE__', strtolower(Utils::singularize($this->entity->name)), $this->stub);
     } else {
         $this->stub = $this->replaceInStub('__MODELINSTANCE__', Utils::singularize($this->entity->name), $this->stub);
     }
     $this->stub = $this->replaceInStub('__MODELINSTANCE_L__', strtolower(Utils::singularize($this->entity->name)), $this->stub);
 }
Beispiel #3
0
 public function makeEvent($entity, $namespace)
 {
     if ($entity->events) {
         foreach ($this->types as $type) {
             $this->type = $type;
             $this->stub = $this->getStub('Event');
             $this->entity = $entity;
             $this->namespace = $namespace;
             $this->path = base_path() . '/app/' . $this->namespace . '/Events/' . $this->entity->name . '/' . Utils::singularize($this->entity->name) . 'Was' . $type . 'd.php';
             $this->setNamespace();
             $this->setModelName();
             $this->setModelInstance();
             $this->setEventType();
             $this->writeFile();
             $this->bag('Created ' . $type . ' Event for : ' . $entity->name);
         }
     }
 }
Beispiel #4
0
 public function makeCommand($entity, $namespace)
 {
     if ($entity->commands) {
         foreach ($this->types as $type) {
             $this->stub = $this->getStub('Commands/' . $type . 'Command');
             $this->entity = $entity;
             $this->namespace = $namespace;
             $this->path = base_path() . '/app/' . $this->namespace . '/Commands/' . $this->entity->name . '/' . $type . Utils::singularize($this->entity->name) . 'Command.php';
             $this->setNamespace();
             $this->setModelName();
             $this->setModelInstance();
             $this->stub = $this->replaceInStub('__FIELDSLIST__', $this->makeFieldList(), $this->stub);
             $this->stub = $this->replaceInStub('__FIELDSLISTSINGLES__', $this->makeFieldListSingles('this'), $this->stub);
             $this->stub = $this->replaceInStub('__FIELDSLISTPARAMS__', $this->makeFieldListParams('public'), $this->stub);
             $this->writeFile();
             $this->bag('Created ' . $type . ' Command for : ' . $entity->name);
         }
     }
 }