本文整理汇总了PHP中Illuminate\View\View::with方法的典型用法代码示例。如果您正苦于以下问题:PHP View::with方法的具体用法?PHP View::with怎么用?PHP View::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\View
的用法示例。
在下文中一共展示了View::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compose
/**
* Applies site wide variables to main layout.
*
* @param $view
*/
public function compose(View $view)
{
$siteTitle = $this->config->get('site.title.main');
$currentUser = $this->sentry->getCurrentUser();
$view->with('siteTitle', $siteTitle);
$view->with('currentUser', $currentUser);
}
示例2: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
if ($this->auth->check()) {
$view->with('auth', $this->user);
$view->with('dashboard', $this->dashboardService->dashboard());
}
}
示例3: compose
/**
* @param View $view
*/
public function compose(View $view)
{
$view->with('currentUser', $this->sentinel->getUser());
$view->with('mode', array_get($view->getData(), 'mode', ''));
$view->with('breadcrumbs', config('shapeshifter.breadcrumbs') ? $this->breadcrumbService->breadcrumbs() : []);
$view->with('menu', $this->menuService->generateMenu());
}
示例4: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$view->with('productsCount', $this->getProductsCount());
$view->with('usersCount', $this->getUsersCount());
$view->with('subscribersCount', $this->getSubscribersCount(app(SubscribersCache::class)));
$view->with('visitors', $this->getUniqueVisitorsCount());
$view->with('dashboardGraph', $this->getDashboardGraph());
}
示例5: callAction
/**
* Execute an action on the controller.
*
* @param string $method
* @param array $parameters
* @return \Symfony\Component\HttpFoundation\Response
*/
public function callAction($method, $parameters)
{
$this->setupLayout();
$response = call_user_func_array(array($this, $method), $parameters);
if ($response instanceof View && !$this->layout->offsetExists('content')) {
return $this->layout->with('content', $response);
}
return $response;
}
示例6: addViewDefaults
/**
* @param \Illuminate\View\View $view
*/
protected function addViewDefaults(\Illuminate\View\View $view)
{
if ($title = $view->title) {
$title .= ' – ';
}
$title .= $this->admin->title;
$view->with('pageTitle', $title);
$view->with('adminTitle', $this->admin->title);
}
示例7: compose
/**
* @param $view
*/
public function compose(View $view)
{
$viewData = $view->getData();
$date = array_has($viewData, 'date') && $viewData['date'] ? $viewData['date'] : Carbon::today();
$calendar = $this->manager->getCalendar(Carbon::today());
$lastBillboard = $this->billboardsRepository->findNewer();
$view->with('calendar', $calendar);
$view->with('date', $date);
$view->with('lastBillboard', $lastBillboard);
}
示例8: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$tasks = $this->tasks->find($view->getData()['tasks']['id']);
/**
* [User assigned the task]
* @var contact
*/
$contact = $tasks->assignee;
$client = $tasks->clientAssignee;
$view->with('contact', $contact);
$view->with('client', $client);
}
示例9: compose
/**
* Compose the View
*
* @param View $view
*
* @return mixed
*/
public function compose(View $view)
{
// check if any args to be provided by extending classes are provided
$this->checkArguments();
$key = h($this->outputVariable);
if ($this->cache->has($key)) {
$view->with($this->outputVariable, $this->cache->get($key));
} else {
$data = $this->getData();
$this->cache->put($key, $data);
$view->with($this->outputVariable, $data);
}
}
示例10: compose
public function compose(View $view)
{
if (self::$cart) {
$view->with('cart', self::$cart);
return;
}
$cart = [];
if (Auth::check()) {
$items = app(CartManager::class)->getItemsForUserGroupedBySeller(Auth::user());
$cart = ['count' => $items->totalCount(), 'items' => $items];
}
$view->with('cart', self::$cart = $cart);
}
示例11: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$client = new Client();
try {
$response = $client->get('http://logger.witr.rit.edu/latest.json', ['timeout' => 1]);
return $view->with('nowplaying', $response->json(['object' => true]));
} catch (RequestException $e) {
$data = new stdClass();
$data->artist = '';
$data->title = 'Not Available';
return $view->with('nowplaying', $data);
}
}
示例12: address
/**
* @param View $view
*/
public function address($view)
{
$viewData = $view->getData();
$address = ['id' => '', 'address1' => '', 'address2' => '', 'address3' => '', 'city' => '', 'state' => '', 'postcode' => '', 'countryId' => ''];
if (isset($viewData['address']) && $viewData['address']) {
foreach ($viewData['address'] as $key => $value) {
$address[$key] = $value;
}
}
$view->with('address', $address);
if (!isset($viewData['prefix'])) {
$view->with('prefix', '');
}
}
示例13: compose
public function compose(View $view)
{
$mainMenu = $this->pages->with('translation')->whereHas('menuPositions', function ($query) {
$query->where('id', 2);
})->get()->toHierarchy();
$view->with('mainMenu', $mainMenu);
}
示例14: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$cart = count(Session::get('cart'));
$categoryModel = new Category();
$baseCategories = $categoryModel->getAllCategories();
$view->with('categories', $baseCategories)->with('cart', $cart);
}
示例15: prepare
public function prepare(View $view, array $parameters)
{
//dd($parameters);
//grab the single post that match's the id in the parameters or routing data sent
$post = $this->posts->where('id', $parameters['id'])->where('slug', $parameters['slug'])->first();
$view->with('post', $post);
}