mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
30 lines
576 B
PHP
30 lines
576 B
PHP
<?php
|
|
|
|
namespace App\Services\Karat;
|
|
|
|
class Client extends Api {
|
|
public $code;
|
|
public $name;
|
|
|
|
public function __construct($code, $name) {
|
|
$this->code = $code;
|
|
$this->name = $name;
|
|
}
|
|
|
|
public static function all() {
|
|
$clients = self::getClients();
|
|
|
|
return collect(array_map(function($client) {
|
|
return new Client( $client['id'], $client['name']);
|
|
}, $clients));
|
|
}
|
|
|
|
public function toArray() {
|
|
return [
|
|
'code' => $this->code,
|
|
'name' => $this->name,
|
|
];
|
|
}
|
|
|
|
}
|