for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Console\Commands;
use App\Task;
use Illuminate\Console\Command;
class ListTaskCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'task:list';
* The console command description.
protected $description = 'List all tasks with a table format.';
* Create a new command instance.
* @return void
public function __construct()
parent::__construct();
}
* Execute the console command.
* @return mixed
public function handle()
//$headers = ['id','name','created_at','updated_at'];
try {
$tasks = Task::all()->toArray();
$headers = array_keys($tasks[0]);
$tasks[0]
App\Task
array
$input
array_keys()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$headers = array_keys(/** @scrutinizer ignore-type */ $tasks[0]);
$this->table($headers, $tasks);
} catch (exception $e) {
App\Console\Commands\exception
exception
\
$this->error('Error: '.$e);