示例#1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $type = $this->argument('type');
     $query = $this->argument('query');
     $results = $this->manager->matches($type, $query, ['limit' => 0]);
     foreach ($results as $item) {
         $this->comment(json_encode($item, JSON_PRETTY_PRINT));
     }
     $this->info('Found ' . count($results) . "for '{$query}'.");
 }
示例#2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $data = explode(PHP_EOL, file_get_contents("php://stdin"));
     $items = array_filter(array_map(function ($json) {
         return json_decode($json, true);
     }, $data), function ($item) {
         return !is_null($item);
     });
     $type = $this->argument('type');
     $inserts = 0;
     if (count($items) > 0) {
         $inserts = $this->manager->load($type, $items);
     }
     $this->info("Loaded a total of {$inserts} items into the {$type} index.");
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $data = explode(PHP_EOL, file_get_contents("php://stdin"));
     $items = array_filter(array_map(function ($json) {
         return json_decode($json, true);
     }, $data), function ($item) {
         return !is_null($item);
     });
     $type = $this->argument('type');
     $removals = 0;
     if (count($items) > 0) {
         foreach ($items as $item) {
             $this->manager->remove($type, $item);
             $removals = $removals + 1;
         }
     }
     $this->info("{$removals} items removed from the {$type} index.");
 }
示例#4
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $type = $this->argument('type');
     $this->manager->clear($type);
     $this->info("{$type} index cleared.");
 }