first commit
This commit is contained in:
		
							
								
								
									
										27
									
								
								app/Traits/SiteApi.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								app/Traits/SiteApi.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Traits; | ||||
|  | ||||
| use GuzzleHttp\Client; | ||||
|  | ||||
| trait SiteApi | ||||
| { | ||||
|  | ||||
|     protected static function getRemote($url, $data = array()) | ||||
|     { | ||||
|         $base = 'https://akaunting.com/api/'; | ||||
|  | ||||
|         $client = new Client(['verify' => false, 'base_uri' => $base]); | ||||
|  | ||||
|         $headers['headers'] = array( | ||||
|             'Authorization' => 'Bearer ' . setting('general.api_token'), | ||||
|             'Accept'        => 'application/json', | ||||
|         ); | ||||
|  | ||||
|         $data = array_merge($data, $headers); | ||||
|  | ||||
|         $result = $client->get($url, $data); | ||||
|  | ||||
|         return $result; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user