本文整理汇总了PHP中Illuminate\View\View::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getData方法的具体用法?PHP View::getData怎么用?PHP View::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\View
的用法示例。
在下文中一共展示了View::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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());
}
示例3: menuLink
/**
* Figures out if the menu item we're displaying should be active
* @param View $view
*/
public function menuLink($view)
{
$viewData = $view->getData();
$activeClass = '';
$item = $viewData['item'];
$slug = $item->slug !== '' ? $item->slug : $item->url;
if ($slug == '') {
$slug = '/foo';
}
// it's active if it's an exact match to the slug
if ('/' . Request::path() == $slug) {
$activeClass = 'active';
} else {
if (strpos('/' . Request::path(), $slug) === 0) {
// unless the slug is the homepage
if ($slug !== '/') {
$activeClass = 'active';
}
if ($slug == '/' && Request::path() == '/') {
$activeClass = 'active';
}
}
}
$clientInfo = Config::get('clientInfo');
$locale = isset($clientInfo->primary_language->language_code) && App::getLocale() == $clientInfo->primary_language->language_code ? '' : '/' . App::getLocale();
$link = $item->slug ? URL::to($locale . $item->slug) : $locale . $item->url;
// translations, if any
$translations = json_decode($item->translations, true);
if (isset($translations[App::getLocale()]) && $translations[App::getLocale()] !== '') {
$item->page_name = $translations[App::getLocale()];
}
$view->with('activeClass', $activeClass)->with('link', $link)->with('item', $item);
}
示例4: compose
/**
* Bind data to the view.
*
* @param \Illuminate\View\View $view
*/
public function compose(View $view)
{
foreach (config('arcanesoft.foundation.sidebar.items', []) as $sidebarKey) {
if (config()->has($sidebarKey)) {
$this->sidebar->add(config($sidebarKey));
}
}
$this->sidebar->setCurrent(Arr::get($view->getData(), 'current_page', ''));
}
示例5: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$type = pathinfo($view->getPath(), PATHINFO_EXTENSION);
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value) && method_exists($value, 'toArray')) {
$value = $value->toArray();
}
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例6: 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);
}
示例7: compose
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$clients = $this->clients->find($view->getData()['client']['id']);
/**
* [User assigned the client]
* @var contact
*/
$contact = $clients->userAssignee;
$view->with('contact', $contact);
}
示例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: 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', '');
}
}
示例10: compose
public function compose(View $view)
{
$data = $view->getData();
if (Auth::check()) {
$this->putUserInfo();
}
if (array_key_exists('group', $data) && $data['group'] instanceof Group) {
JavaScript::put(['group' => $data['group']]);
}
if (array_key_exists('content', $data) && $data['content'] instanceof Content) {
JavaScript::put(['content' => $data['content']->toArray()]);
}
JavaScript::put(['config' => ['env' => app()->environment(), 'pusher_key' => config('broadcasting.connections.pusher.key')]]);
}
示例11: compose
/**
* Composer for updating a course
* @param View $view
*/
public function compose(View $view)
{
$course = $view->getData()['course'];
$empty_link = new Link(['link' => "", 'name' => ""]);
$empty_link->id = 0;
$links = \Link::getAllLinks($course);
$length = count($links) > 0 ? $links[count($links) - 1]->id + 1 : 1;
\JavaScript::put(['links' => $length]);
$view->with('empty_link', $empty_link);
$view->with('images', \Image::listImages($course));
$view->with('videos', \Video::listVideos($course));
$view->with('ebooks', \Ebook::listEbooks($course));
$view->with('links', $links);
$view->with('body', \Resource::getCourseBody($course));
}
示例12: compose
/**
* Composer for showing a course
* @param View $view
*/
public function compose(View $view)
{
$course = $view->getData()['course'];
$view->with('course_categories', \Category::getCourseCategories($course));
$view->with('images', \Image::listImagesWithCleanPath($course));
$view->with('videos', \Video::listVideosWithCleanPath($course));
$view->with('ebooks', \Ebook::listEbooksWithCleanPath($course));
$view->with('links', \Link::listLinksWithNames($course));
$view->with('created_at', \MyCarbon::format($course->created_at->diffForHumans()));
$view->with('course_user', $course->user);
$view->with('count_likes', \Course::countLikes($course));
$view->with('count_dislikes', \Course::countDislikes($course));
if (Auth::check()) {
\JavaScript::put(['star_index' => \Course::getLikeRating($course, Auth::user())]);
}
}
示例13: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
if (!$this->collect_data) {
$this->views[] = $name;
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value) and method_exists($value, 'toArray')) {
$data[$key] = $value->toArray();
} else {
$data[$key] = $value;
}
}
$this->views[] = $name . ' => ' . $this->formatVar($data);
}
}
示例14: slider
/**
* @param View $view
*/
public function slider($view)
{
$viewData = $view->getData();
if (!isset($viewData['options'])) {
$viewData['options'] = json_decode($viewData['element']->element_options, true);
}
$slider_id = $viewData['options']['id'];
try {
$slider = VendirunApi::makeRequest('cms/slider', ['id' => $slider_id])->getData();
$sliderStyles = $this->getSliderStyles($slider);
$slideStyles = $this->getSlideStyles($slider);
} catch (FailResponseException $e) {
$slider = false;
$sliderStyles = [];
$slideStyles = [];
}
$view->with('slider', $slider)->with('sliderStyles', $sliderStyles)->with('slideStyles', $slideStyles);
}
示例15: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
if (!$this->collect_data) {
$this->data[$name] = $name;
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value)) {
if (method_exists($value, 'toArray')) {
$data[$key] = $value->toArray();
} else {
$data[$key] = "Object (" . get_class($value) . ")";
}
} else {
$data[$key] = $value;
}
}
$this->data[$name] = $data;
}
}