예제 #1
0
 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);
         }
     }
 }
예제 #2
0
파일: Nest.php 프로젝트: sidis405/eagle
 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);
 }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }