code = $code; $this->name = $name; $this->client_id = $client_id; } public static function all() { $projects = self::getProjects(); return collect(array_map(function($project) { return new Project( $project['id'], $project['name'], $project['client_id']); }, $projects)); } public function toArray() { return [ 'code' => $this->code, 'name' => $this->name, 'client_id' => $this->client_id, ]; } }