Пример #1
0
 function __construct()
 {
     $this->errors = new MessageBag();
     $this->page_attributes = new \Stdclass();
     $api_url = '/oauth/client/access_token';
     $api_data = ['grant_type' => 'client_credentials', 'client_id' => env('CLIENT_ID'), 'client_secret' => env('CLIENT_SECRET')];
     $api = new API();
     $result = json_decode($api->post($api_url, $api_data), true);
     // Get success API token
     if ($result['status'] == "success") {
         Session::set('API_token_public', $result['data']['token']['token']);
         Session::set('API_token', $result['data']['token']['token']);
     } else {
         \App::abort(503);
     }
     //generate balin information
     $APIConfig = new APIConfig();
     $config = $APIConfig->getIndex(['search' => ['default' => 'true'], 'sort' => ['name' => 'asc']]);
     $balin = $config['data'];
     unset($balin['info']);
     foreach ($config['data']['info'] as $key => $value) {
         $balin['info'][$value['type']] = $value;
     }
     $this->balin = $balin;
     //nanti kalu butuh template lebih dari satu, switch case aja disini.
     $this->layout = view('web_v2.page_templates.layout');
 }
Пример #2
0
 public function balininfo()
 {
     $APIConfig = new APIConfig();
     $config = $APIConfig->getIndex(['search' => ['default' => 'true'], 'sort' => ['name' => 'asc']]);
     $balin = $config['data'];
     unset($balin['info']);
     foreach ($config['data']['info'] as $key => $value) {
         $balin['info'][$value['type']] = $value['value'];
     }
     return $balin['info'];
 }