예제 #1
0
 /**
  * Handle the command.
  *
  * @param AddonCollection $addons
  * @param Seeder          $seeder
  */
 public function handle(AddonCollection $addons, Seeder $seeder)
 {
     $seeder->setContainer(app());
     $seeder->setCommand($command->getCommand());
     Model::unguard();
     $class = $command->getClass();
     $addon = $addons->get($command->getAddon());
     /*
      * Depending on when this is called, and
      * how seeding uses the view layer the addon's
      * could be decorated, so un-decorate them real
      * quick before proceeding.
      */
     if ($addon && $addon instanceof Presenter) {
         $addon = $addon->getObject();
     }
     /*
      * If the addon was passed then
      * get it and seed it.
      */
     if ($addon) {
         if (class_exists($this->getSeederClass($addon))) {
             $seeder->call($this->getSeederClass($addon));
         }
     }
     /*
      * If a seeder class was passed then
      * call it from the seeder utility.
      */
     if (!$addon && $class) {
         if (class_exists($class)) {
             $seeder->call($class);
         }
     }
 }
예제 #2
0
 /**
  * Call a seeder if it exists.
  *
  * @param $class
  */
 protected function call($class)
 {
     if (class_exists($class)) {
         $this->seeder->call($class);
     }
 }