1 | <?php |
||
2 | |||
3 | namespace Ijeffro\Laralocker\LearningLocker\Visualisations; |
||
4 | |||
5 | use Ijeffro\Laralocker\LearningLocker\API\APIHandler; |
||
6 | |||
7 | class VisualisationHandler extends APIHandler implements VisualisationInterface { |
||
8 | |||
9 | private $visualisation = '/visualisation'; |
||
10 | private $api = '/api'; |
||
11 | private $v1 = '/v1'; |
||
12 | private $v2 = '/v2'; |
||
13 | |||
14 | protected $headers = [ |
||
15 | 'content-type' => 'application/json' |
||
16 | ]; |
||
17 | |||
18 | function __construct($id = null) { |
||
19 | parent::__construct(); |
||
20 | $this->id = $id; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Learning Locker: Request Organisation Details |
||
25 | * |
||
26 | * @return $response |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
27 | */ |
||
28 | public function get() { |
||
29 | try { |
||
30 | $url = $this->url . $this->api . $this->v2 . $this->visualisation; |
||
31 | $response = $this->request($url); |
||
32 | return $response; |
||
33 | } catch (Exception $e) { |
||
34 | return $e; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Learning Locker: Request Organisation Details |
||
40 | * |
||
41 | * @return $response |
||
0 ignored issues
–
show
|
|||
42 | */ |
||
43 | public function update($data) { |
||
44 | try { |
||
45 | $url = $this->url . $this->api . $this->v2 . $this->visualisation . '/' . $this->id ?? $this->id; |
||
46 | // dd($url); |
||
47 | $response = $this->save($url, $data); |
||
48 | return $response; |
||
49 | } catch (Exception $e) { |
||
50 | return $e; |
||
51 | } |
||
52 | } |
||
53 | |||
54 | } |
||
55 |