protected function view($view = null, $data = array(), $mergeData = array()) { if (array_search('Barryvdh\\Debugbar\\LaravelDebugbar', get_declared_classes()) !== FALSE) { \Debugbar::startMeasure('admin_view', 'Admin view generation'); } $this->loadBaseComposer(); $content = view($view, array_merge($data, ['_ctrl' => $this]), $mergeData)->render(); $content = view('admin::layout.base', ['content' => $content, '_ctrl' => $this]); if (array_search('Barryvdh\\Debugbar\\LaravelDebugbar', get_declared_classes()) !== FALSE) { \Debugbar::stopMeasure('admin_view'); } return $content; }
public function showArticle($id) { Debugbar::startMeasure('load data', '载入文章数据'); $article = new Article($id); try { $article->load(); } catch (Exception $ex) { return View::make('error/custom', array('error' => $ex->getMessage())); } Debugbar::stopMeasure('load data'); Debugbar::startMeasure('render article', '渲染'); $view = View::make('site/article/view', array('article' => $article->data, 'needRefresh' => $article->needRefresh())); Debugbar::stopMeasure('render article'); return $view; }
/** * @param $itemInfo * @return Item */ public function parseItem($itemInfo) { if (empty($itemInfo) || !is_array($itemInfo)) { throw new \InvalidArgumentException('ItemInfo should be filled array!'); } $key = md5(json_encode($itemInfo)); if (isset(self::$itemCache[$key]) && !empty(self::$itemCache[$key])) { return self::$itemCache[$key]; } \Debugbar::startMeasure('parseItem', 'Парсим предмет ' . $itemInfo['name']); /** @var Item $item */ $item = ItemStorage::createItem($itemInfo); if ($itemInfo['tradable'] !== '0') { try { /** @var $price ItemPrice */ $price = $this->priceHelper->getItemPrice($item); $item->setPrice($price); } catch (\Exception $e) { \Log::debug($e->getMessage()); } } \Debugbar::stopMeasure('parseItem'); return $item; }
<?php use App\User; Route::group(['middleware' => ['web']], function () { Route::get('testSendEmail1', 'ContactEmailController@sendEmail'); Route::get('/testSendEmail2', function (User $user) { //Profiling Debugbar::startMeasure("SendSubscriptionEmail"); dispatch(new \App\Jobs\SendSubscriptionEmail($user)); Debugbar::stopMeasure("SendSubscriptionEmail"); return 'Done!'; }); // Deprecated in 5.2: // Route::controller() Route::get('pricingtables/usecase1', 'PricingTableController@index'); Route::get('pricingtables/usecase2', 'PricingTableController@index2'); });
function SearchTourOptions() { $env = env('TAG_OPTION', 'static'); ///////////////// // Location // ///////////////// if (str_is('dynamic', $env)) { $data = API::GetDestinationTags(); $destination = []; foreach ($data as $key => $value) { $dest = explode('.', $value->tag); if (count($dest) > 2) { if (isset($destination[strtolower($dest[count($dest) - 2])])) { $destination[strtolower($dest[count($dest) - 2])][] = $dest[strtolower(count($dest) - 1)]; } else { $new = [strtolower($dest[count($dest) - 2]) => [$dest[strtolower(count($dest) - 1)]]]; $destination = array_merge($destination, $new); } } else { if (isset($destination[strtolower($dest[0])])) { $destination[strtolower($dest[0])][] = strtolower($dest[1]); } else { $new = [strtolower($dest[0]) => [strtolower($dest[1])]]; $destination = array_merge($destination, $new); } } } } else { $destination['Indonesia'] = ['Aceh', 'Balikpapan', 'Bali', 'Bandung', 'Bangka', 'Banten', 'Belitung', 'Derawan', 'Flores', 'Jakarta', 'Jawa Tengah', 'Jawa Timur', 'Karimun Jawa', 'Kepulauan Riau', 'Lampung', 'Lombok', 'Makassar', 'Malang', 'Maluku', 'Manado', 'Medan', 'Nusa Tenggara Barat', 'Nusa Tenggara Timur', 'Padang', 'Pontianak', 'Pulau Seribu', 'Raja Ampat', 'Riau', 'Semarang', 'Solo', 'Surabaya', 'Wakatobi', 'Yogyakarta']; $destination['Asia'] = ['Arab Saudi', 'Brunei Darussalam', 'China', 'Filipina', 'India', 'Israel', 'Jepang', 'Kamboja', 'Kazakhstan', 'Kirgizstan', 'Korea Selatan', 'Laos', 'Malaysia', 'Myanmar', 'Republik Maladewa', 'Singapura', 'Taiwan', 'Thailand', 'Uni Emirat Arab', 'Uzbekistan', 'Vietnam']; $destination['Australia'] = ['Gold Coast', 'Melbourne', 'Perth', 'South Australia', 'Sydney']; $destination['Eropa'] = ['Austria', 'Armenia', 'Belanda', 'Belgia', 'Denmark', 'Finlandia', 'Georgia', 'Hongaria', 'Inggris', 'Italia', 'Jerman', 'Liechtenstein', 'Luxembourg', 'Monako', 'Norwegia', 'Perancis', 'Polandia', 'Portugal', 'Republik Ceko', 'Rusia', 'Skotlandia', 'Slovakia', 'Spanyol', 'Swedia', 'Swiss', 'Turki', 'Vatican']; $destination['Amerika'] = ['Kanada', 'USA']; $destination['Oceania'] = ['Hawaii', 'New Zealand']; $destination['Afrika'] = ['Kenya', 'Madagaskar', 'Maroko', 'Mesir', 'South Afrika', 'Yordania']; } $destination_options[] = "Semua Tujuan"; foreach ($destination as $k => $v) { $destination_options[$k] = $k; foreach ($v as $v2) { $destination_options[strtolower($v2)] = ' ' . $v2; } } //////////// // harga // //////////// $harga[''] = 'Semua harga'; $harga['1-1000000'] = 'Di bawah Rp. 1.000.000'; $harga['1000000-2500000'] = 'Rp. 1.000.000 - Rp. 2.500.000'; $harga['2500000-5000000'] = 'Rp. 2.500.000 - Rp. 5.000.000'; $harga['5000000-10000000'] = 'Rp. 5.000.000 - Rp. 10.000.000'; $harga['10000000-20000000'] = 'Rp. 10.000.000 - Rp. 20.000.000'; $harga['20000000'] = 'Rp. 20.000.000 ke atas'; /////////// // Waktu // /////////// $period[] = 'Kapanpun'; for ($i = 0; $i <= 12; $i++) { $period[\Carbon\Carbon::parse('first day of this month')->addMonth($i)->format('m-Y')] = \Carbon\Carbon::parse('first day of this month')->addMonth($i)->format('M Y'); } ////////////////// // Travel Agent // ////////////////// \Debugbar::startMeasure('API: travel_agents', 'API: travel_agents'); $tmp = json_decode($this->api->get($this->api_url . '/travel_agents?access_token=' . Session::get('access_token'))->getBody()); \Debugbar::stopMeasure('API: travel_agents'); $travel_agents[] = "Semua Travel Agent"; foreach ($tmp->data->data as $travel_agent) { $travel_agents[strtoupper(substr($travel_agent->name, 0, 1))][$travel_agent->slug] = str_limit($travel_agent->name, 30); $this->travel_agent_ids[$travel_agent->slug] = $travel_agent->_id; } ////////////// // Interest // ////////////// \Debugbar::startMeasure('API: tag', 'API: tag'); $tmp = json_decode($this->api->get($this->api_url . '/tags?type=interest&access_token=' . Session::get('access_token'))->getBody()); \Debugbar::stopMeasure('API: tag'); $interest = $tmp->data->data; ////////////////////////// // Assign to global var // ////////////////////////// $this->search_tour_options['destinations'] = $destination_options; $this->search_tour_options['harga'] = $harga; $this->search_tour_options['period'] = $period; $this->search_tour_options['travel_agents'] = $travel_agents; $this->search_tour_options['interest'] = $interest; }
/** * For Debugbar start measure method */ function start($name = 'Custom vendor', $description = null) { return Debugbar::startMeasure($name, $description); }
<?php use App\User; Route::group(['middleware' => ['web', 'pjax']], function () { //Route::get('testSendEmail', 'ContactEmailController@sendEmail'); // Alternativa Route::get('/testSendEmail', function (User $user) { Debugbar::startMeasure('SendSubscriptionEmail'); dispatch(new \App\Jobs\SendSubscriptionEmail($user)); Debugbar::stopMeasure('SendSubscriptionEmail'); return 'Done!'; }); });
static function GetLatestArticles($skip, $take = 1) { Static::init(); $query['skip'] = max(0, $skip); $query['take'] = max(1, $take); $query['mode'] = 'latest_published'; $query['with_count'] = true; \Debugbar::startMeasure('API: Article', 'API: Article'); $api_response = Cache::remember('lastest_articles_' . $query['skip'] . '_' . $query['take'], 20, function () use($query) { return json_decode(self::$api->get(self::$api_url . '/articles?' . http_build_query(array_merge($query, ['access_token' => Session::get('access_token')])))->getBody(), false); }); \Debugbar::stopMeasure('API: Article'); $data_count = $api_response->data->count; $latest_articles = $api_response->data->data; $latest_articles = API::reformat_images($latest_articles); return ['count' => $data_count, 'data' => $latest_articles]; }
| | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/login', ['as' => 'auth.login', 'uses' => 'LoginController@getLogin']); Route::post('/postLogin', ['as' => 'auth.postLogin', 'uses' => 'LoginController@postLogin']); Route::get('/', function () { return view('welcome'); }); Route::get('/home', ['as' => 'auth.home', function () { return view('home'); }]); Route::get('/', function () { \Debugbar::startMeasure("resource"); $authenticated = false; Session::set('authenticated', false); // dd (Session::all()); // \Debugbar::info("Xivato1!!!"); //\Debugbar::info(Session::all()); if (Session::has('authenticated')) { if (Session::get('authenticated') == true) { $authenticated = true; } } if ($authenticated) { \Debugbar::stopMeasure("resource"); return view('resource'); } else { return view('login');
/** * Start the profile for debugging. * * @param string $name */ function start_profile($name) { if (config('debugbar.enabled', false)) { Debugbar::startMeasure($name); } }