/** * Set data to view of current path * * @param \Teepluss\Theme\Theme $theme * @param $path * * @return $this */ public function initViewData(\Teepluss\Theme\Theme $theme, $path) { /*Merge from another modules*/ $this->initAdditionData($path); if (isset($this->data[$path])) { foreach ($this->data[$path] as $items) { foreach ($items as $k => $item) { $theme->set($k, $item); } } } return $this; }
function listByCurrencyCompareToday($currency1, $currency) { $data['dataKurs'] = KursModel::where('created_at', date('Y-m-d'))->join('currency', 'kurs.currency_code', '=', 'currency.currency_code')->where('currency_alias', str_slug($currencyName))->orderBy('rate_date', 'desc')->orderBy('kurs.currency_code', 'asc')->get(); $this->theme->setTitle('Kurs Rupiah Hari Ini'); $data['updatedDate'] = $data['dataKurs'][0]['created_at']; return $this->theme->scope('home', $data)->render(); }
/** * Display a listing of the resource. * * @return FrontGlobalData */ public function index() { #-- Prepare public vars $this->theme->asset()->writeScript('inline-script', ' var GS_VARS = { PUBLIC_URL: "' . url('/') . '", ASSETS_URL: "' . url('/assets') . '", _TOKEN: "' . csrf_token() . '" }; ', array()); #-- Push view return $this->theme->scopeWithLayout('home')->render(); }