28 lines
750 B
PHP
28 lines
750 B
PHP
<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use App\Component\Models\ClientsGroup;
|
|
use App\Console\Commands\HRCCommand;
|
|
use App\Console\Commands\HRCCommandInterface;
|
|
|
|
class GETClientGroup extends HRCCommand implements HRCCommandInterface {
|
|
protected $signature = 'getclientgroup';
|
|
|
|
public function command($input, $output = null) {
|
|
if (ClientsGroup::where('code', '0')->count() == 0) {
|
|
$group = new ClientsGroup;
|
|
$group->code = '0';
|
|
$group->name = 'Без группы';
|
|
$group->save();
|
|
}
|
|
$client_groups = ClientsGroup::orderBy('code')->get();
|
|
foreach ($client_groups as $client_group) {
|
|
$out[] = array('id' => $client_group['id'], 'name' => $client_group['name']);
|
|
}
|
|
return [
|
|
'status' => 'success',
|
|
'groups' => $out,
|
|
];
|
|
}
|
|
} |