本文整理汇总了PHP中Illuminate\View\View类的典型用法代码示例。如果您正苦于以下问题:PHP View类的具体用法?PHP View怎么用?PHP View使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compose
public function compose(View $view)
{
$documentForm = \Request::only('responsable_id');
$route = Route::currentRouteName();
$users = User::orderBy('name', 'ASC')->lists('name', 'id')->toArray();
$view->with(compact('documentForm', 'users', 'route'));
}
示例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: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if (!is_object($path)) {
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
} else {
$type = get_class($view);
$path = '';
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例4: 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);
}
示例5: 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);
}
示例6: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
if ($this->djs == null) {
$this->djs = DJ::orderBy('name', 'asc')->get();
}
$view->with('djs', $this->djs);
}
示例7: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (in_array($key, ['__env', 'app', 'errors', 'obLevel', 'currentUser'])) {
continue;
}
$data[$key] = $this->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例8: 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);
}
示例9: create
/**
* Bind data to the view.
*
* @param View $view
*/
public function create(View $view)
{
if ($this->googleTagManager->isEnabled() && empty($this->googleTagManager->id())) {
throw new ApiKeyNotSetException();
}
$view->with('enabled', $this->googleTagManager->isEnabled())->with('id', $this->googleTagManager->id())->with('dataLayer', $this->googleTagManager->getDataLayer());
}
示例10: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$productAttrobuteModel = new ProductAttribute();
$isFeaturedOptions = $productAttrobuteModel->getIsFeaturedOptions();
$statusOptions = $productAttrobuteModel->getStatusOptions();
$view->with('isFeaturedOptions', $isFeaturedOptions)->with('statusOptions', $statusOptions);
}
示例11: 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);
}
示例12: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$user = $this->user->find($this->user_auth->id);
$notifications = $user->notifications()->noread()->get();
$notificationsCount = $notifications->count();
$view->with(['notifications' => $notifications, 'notificationsCount' => $notificationsCount]);
}
示例13: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$user = Cache::remember('user', 1440, function () {
return Auth::user();
});
$view->with('user', $user);
}
示例14: setContent
/**
* Set the content for the reponse.
*
* @return \Illuminate\View\View
*/
public function setContent($view, $data = [])
{
if (!is_null($this->layout)) {
return $this->layout->nest('content', $view, $data);
}
return view($view, $data);
}
示例15: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
if ($this->shows == null) {
$this->shows = Show::orderBy('name', 'asc')->get();
}
$view->with('shows', $this->shows);
}