本文整理汇总了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
}
示例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);
}
示例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));
}
示例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);
}
示例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']);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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'));
}
示例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'));
}
示例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);
}
示例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);
}