protected function execute(InputInterface $input, OutputInterface $output) { $search = $input->getArgument('search'); if (is_numeric($search)) { $q = Product::where('id', '=', $input); } else { $q = Product::whereLike($search); } $products = $q->select(['id', 'description', 'price', 'category'])->limit(15)->get(); $products = $products->toArray(); $table = new Table($output); $table->setHeaders(array('Codice', 'Descrizione', 'Prezzo', 'Categoria'))->setRows($products)->setStyle('borderless'); $table->render(); }