API v.1.5: Update, Delete clients

This commit is contained in:
miroman-afk
2021-06-04 13:46:11 +03:00
parent a290eb3a80
commit 7325d8946a
5 changed files with 111 additions and 7 deletions

View File

@@ -3,6 +3,9 @@
namespace App\Commands;
use App\Component\Models\Client;
use App\Component\Models\ClientsAddress;
use App\Component\Models\ClientsBarcode;
use App\Component\Models\ClientsEmail;
use App\Component\Models\ClientsGroup;
use App\Component\Models\ClientsPhone;
use App\Console\Commands\HRCCommand;
@@ -41,7 +44,19 @@ class Clients extends HRCCommand implements HRCCommandInterface {
foreach ($clients as $client) {
$phone = ClientsPhone::where('client_guid', '=', $client['user_code'])->first();
$out[] = array('id' => $client['id'], 'name' => $client['name'], 'phone' => $phone['phone']);
$email = ClientsEmail::where('client_guid', '=', $client['user_code'])->first();
$address = ClientsAddress::where('client_guid', '=', $client['user_code'])->first();
$barcode = ClientsBarcode::where('client_guid', '=', $client['user_code'])->first();
$group = ClientsGroup::where('code', '=', $client['group_id'])->first();
$out[] = array(
'id' => $client['id'],
'client_group' => $group['id'],
'name' => $client['name'],
'phone' => $phone['phone'],
'email' => $email['email'],
'address' => $address['address'],
'barcode' => $barcode['code_id'],
);
}
return [
'status' => 'success',