當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View::getData方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\View\View::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::getData方法的具體用法?PHP View::getData怎麽用?PHP View::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\View\View的用法示例。


在下文中一共展示了View::getData方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: compose

 /**
  * Bind data to the view.
  *
  * @param  View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     if ($view->group_form_errors and $view->errors->any()) {
         $view->nest('form_error_content', $view->bsb_pkg_ref . '::form.control.errors', ['errors' => $view->errors->all()]);
     }
     foreach ($view->groups as $name => &$input) {
         if (is_array($input)) {
             if (count(array_filter(array_keys($input), 'is_string'))) {
                 //The array contains named keys, generate inputs from these options
                 $view_name = $view->bsb_pkg_ref . '::input.' . (empty($input['type']) ? 'text' : $input['type']);
                 if (!view()->exists($view_name)) {
                     $view_name = $view->bsb_pkg_ref . '::input.' . 'text';
                 }
                 $input = view($view_name, array_merge(compact('name'), $input), $view->getData());
             } else {
                 //The array contains html strings, display them together within a form-group
                 $input = view($view->bsb_pkg_ref . '::input.group', ['content' => implode("\n", $input)], $view->getData());
             }
         } elseif (!str_contains($input, '.form-group')) {
             //The input is just a string of html, but it doesn't contain any .form-group element, so we'll wrap it in one
             $input = view($view->bsb_pkg_ref . '::input.group', ['content' => $input], $view->getData());
         }
     }
     //TODO: add form-horizontal and form-inline options
 }
開發者ID:fewagency,項目名稱:twbs-blade,代碼行數:32,代碼來源:FormComposer.php

示例2: compose

 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $sidebar_tags = [];
     if (isset($view->getData()['tree']) && !isset($view->getData()['trees'])) {
         $sidebar_tags = $view->getData()['tree']->getAllTags();
     }
     $view->with('sidebar_tags', $sidebar_tags);
 }
開發者ID:hitandyrun,項目名稱:arguesecure-online,代碼行數:14,代碼來源:SidebarViewComposer.php

示例3: compose

 /**
  * Composer for showing a user
  *
  * @param View $view
  */
 public function compose(View $view)
 {
     $user = $view->getData()['user'];
     $view->with('user_courses', \User::userCoursesPaginate($user));
     $view->with('user_courses_count', \User::countUserCourses($user));
     $view->with('count_followers', \User::countFollowers($user));
 }
開發者ID:bohap,項目名稱:online-study,代碼行數:12,代碼來源:ShowUserComposer.php

示例4: compose

 /**
  * Bind data to the view.
  *
  * @param View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $data = $view->getData();
     if (Auth::check()) {
         $notifications = Auth::user()->notifications()->with('user')->orderBy('created_at', 'desc')->take(15)->get();
         $view->with('notifications', $notifications);
         $unreadCount = Auth::user()->notifications()->wherePivot('read', false)->count();
         $view->with('newNotificationsCount', $unreadCount);
     }
     // Get object from which we can extract name to use as page title
     $currentGroup = head(array_only($data, ['group', 'folder', 'fakeGroup']));
     $view->with('currentGroup', $currentGroup);
     if (isset($currentGroup) && isset($currentGroup->name)) {
         $pageTitle = $currentGroup->name;
         // Homepage title shall always be Strimoid.pl
         if ($currentGroup->urlname == 'all' && !Setting::get('homepage_subscribed', false)) {
             $pageTitle = 'Strimoid';
         }
         if ($currentGroup->urlname == 'subscribed' && Setting::get('homepage_subscribed', false)) {
             $pageTitle = 'Strimoid';
         }
     } else {
         $pageTitle = 'Strimoid';
     }
     $view->with('pageTitle', $pageTitle);
     // Needed by top bar with groups
     $popularGroups = Cache::remember('popularGroups', 60, function () {
         return Group::orderBy('subscribers_count', 'desc', true)->take(30)->get(['id', 'name', 'urlname']);
     });
     $view->with('popularGroups', $popularGroups);
 }
開發者ID:vegax87,項目名稱:Strimoid,代碼行數:38,代碼來源:MasterComposer.php

示例5: compose

 public function compose(View $view)
 {
     $viewData = $view->getData();
     if (!array_keys_exist(['module', 'model', 'errors'], $viewData)) {
         return;
     }
     app(BlenderFormBuilder::class)->init($viewData['module'], $viewData['model'], $viewData['errors']);
 }
開發者ID:spatie-custom,項目名稱:blender,代碼行數:8,代碼來源:BlenderFormComposer.php

示例6: compose

 /**
  * @param View $view
  * @throws InstanceMissmatchException
  */
 public function compose(View $view)
 {
     $data = array_get($view->getData(), 'metaData', $this->wrapper->getMetaData());
     if (!$data instanceof MetaData) {
         throw new InstanceMissmatchException(sprintf('Data [%s] is not an instance of [%s]', gettype($data), MetaData::class));
     }
     $view->with('metaData', $data);
 }
開發者ID:wearejust,項目名稱:metadata,代碼行數:12,代碼來源:ViewComposer.php

示例7: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     //Get the data
     $list = $this->list_repository->getByModule($viewParameters['module_id']);
     // Agregate and Send the data to the view
     $data = array('list' => $list);
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:10,代碼來源:MakerComposer.php

示例8: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     //Get the data
     $slideshow = $this->slideshow_repository->getByModule($viewParameters['module_id']);
     // Agregate and Send the data to the view
     $data = array_merge(array('slideshow' => $slideshow), $viewParameters);
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:10,代碼來源:MakerComposer.php

示例9: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     //Get the data
     $group_module = $this->repository->getByModule($viewParameters['module_id']);
     $modules = $this->module_repository->all();
     // Agregate and Send the data to the view
     $data = array_merge(array('group_module' => $group_module, 'modules' => $modules));
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:11,代碼來源:MakerComposer.php

示例10: compose

 /**
  * Bind data to the view.
  *
  * @param \Illuminate\Contracts\View\View $view
  */
 public function compose(View $view)
 {
     $view->withThemeBackgroundColor(Setting::get('style_background_color'));
     $view->withThemeTextColor(Setting::get('style_text_color'));
     $viewData = $view->getData();
     $themeView = array_only($viewData, preg_grep('/^theme/', array_keys($viewData)));
     $hasThemeSettings = array_filter($themeView, function ($data) {
         return $data != null;
     });
     $view->withThemeSetup(!empty($hasThemeSettings));
 }
開發者ID:RetinaInc,項目名稱:Cachet,代碼行數:16,代碼來源:ThemeComposer.php

示例11: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     //Set languages to the $data
     $parameters = $viewParameters['parameters'];
     $data = array('langs' => $this->lang_repository->all());
     // Agregate and Send the data to the view
     $data = array_merge($data, $viewParameters);
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:11,代碼來源:ShowComposer.php

示例12: compose

 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $employee = $view->getData()['employee'];
     $credit = $employee->leave_credit;
     $accumulated = $employee->accumulated_leave;
     $credits = collect();
     $credits->push(['title' => 'Force leave', 'icon' => 'envelope', 'color' => 'warning', 'count' => $credit->force_leave]);
     $credits->push(['title' => 'Special leave', 'icon' => 'star', 'color' => 'primary', 'count' => $credit->special_leave]);
     $credits->push(['title' => 'Vacation leave', 'icon' => 'plane', 'color' => 'primary', 'count' => $accumulated->vacation_leave]);
     $credits->push(['title' => 'Sick leave', 'icon' => 'hospital-o', 'color' => 'danger', 'count' => $accumulated->sick_leave]);
     $view->with(compact('credits'));
 }
開發者ID:rosemalejohn,項目名稱:dnsc-hris,代碼行數:18,代碼來源:LeaveCredits.php

示例13: compose

 public function compose(View $view)
 {
     $voteValue = 0;
     $comment = $view->getData()['comment'];
     if (Auth::check()) {
         $votes = $comment->votes()->where('user_id', Auth::id());
         if ($votes->count() > 0) {
             $voteValue = $votes->first()->value;
         }
     }
     $view->with('voteValue', $voteValue);
     $view->with('score', $comment->votes()->sum('value'));
 }
開發者ID:ntzm,項目名稱:laravit,代碼行數:13,代碼來源:CommentComposer.php

示例14: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     //Get the data
     $folders = $this->folder_repository->getFullFolders();
     $foldersroot = array();
     foreach ($folders as $folder) {
         if ($folder->folder_parent_id == null) {
             $foldersroot[] = $folder;
         }
     }
     $images = $this->image_repository->getListByFolder();
     $data = array_merge($images, array('foldersroot' => $foldersroot, 'folders' => $folders));
     // Agregate and Send the data to the view
     $data = array_merge($data, $viewParameters);
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:18,代碼來源:ImagesUrlComposer.php

示例15: compose

 public function compose(View $view)
 {
     //Get the data from the view
     $viewParameters = $view->getData();
     $parameters = $viewParameters['parameters'];
     $data = array();
     if (count($parameters) >= 2 && isset($parameters['profile']) && is_numeric($parameters['profile'])) {
         $user_id = intval($parameters['profile']);
         $user = $this->user_repository->show($user_id);
         if ($user != null) {
             $data = array_merge(array('mode' => 'show'), $user);
         }
     } else {
         $data = array('mode' => 'list', 'users' => $this->user_repository->index(10));
     }
     // Agregate and Send the data to the view
     $data = array_merge($data, $viewParameters);
     $view->with($data);
 }
開發者ID:noikiy,項目名稱:AngkorCMS,代碼行數:19,代碼來源:ShowProfileComposer.php


注:本文中的Illuminate\Contracts\View\View::getData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。