v.2.13
-Add delete reports
This commit is contained in:
35
commands/GETReports.php
Normal file
35
commands/GETReports.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Report;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETReports extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getreports';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$reports = Report::all();
|
||||
if ($reports) {
|
||||
foreach ($reports as $key => $report) {
|
||||
$data[] = array(
|
||||
'id' => $report['id'],
|
||||
'name' => $report['name'],
|
||||
'type' => $report['report_type'],
|
||||
'start_date' => date('d.m.Y', strtotime($report['start_date'])),
|
||||
'end_date' => date('d.m.Y', strtotime($report['end_date'])),
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'reports' => $data,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'reports' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user