Esempio n. 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $fileLoader = new \NAB\Loader\Driver\File();
     $fileLoader->setOptions(array('file' => $this->argument('filename')));
     $demo = new Demo();
     $demo->setInputDriver($fileLoader);
     $result = $demo->findAll();
     return $this->render($result);
 }
Esempio n. 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $fileLoader = new \NAB\Loader\Driver\File();
     $id = $this->argument('id');
     $fileLoader->setOptions(array('file' => $this->argument('filename')));
     $demo = new Demo();
     $demo->setInputDriver($fileLoader);
     $result = $demo->findById($id);
     if ($result->count() > 1) {
         $this->error("More than one item found with id '{$id}'");
         return;
     }
     return $this->render($result);
 }
Esempio n. 3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $fileLoader = new \NAB\Loader\Driver\File();
     $fileLoader->setOptions(array('file' => $this->argument('filename')));
     $demo = new Demo();
     $demo->setInputDriver($fileLoader);
     $results = $demo->findAll();
     $categories = [];
     foreach ($results as $item) {
         foreach ($item->getCategories() as $category) {
             if (!in_array($category, $categories)) {
                 $categories[] = $category;
             }
         }
     }
     foreach ($categories as $category) {
         $this->info($category);
         $result = $demo->findByCategory($category);
         $this->render($result, array('prefix' => "\t", 'show_categories' => false));
     }
 }