本文整理汇总了PHP中Illuminate\View\Factory::composer方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::composer方法的具体用法?PHP Factory::composer怎么用?PHP Factory::composer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\Factory
的用法示例。
在下文中一共展示了Factory::composer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Controller init.
* @param Backend $backend
* @param ViewFactory $view
*/
public function init(Backend $backend, ViewFactory $view)
{
$backend->setActiveMenu('system.users');
$view->composer($this->viewName('users.form'), function (View $view) {
$view->with('groups', GroupModel::query()->get());
});
}
示例2: init
/**
* Init controller.
* @param Backend $backend
* @param ViewFactory $view
*/
public function init(Backend $backend, ViewFactory $view)
{
$backend->setActiveMenu('system.groups');
$view->composer($this->viewName('groups.form'), function (View $view) use($backend) {
$view->with('rules', $backend->getAclGroups());
});
}
示例3: make
/**
* Create a new menu instance.
*
* @param string $name
* @param callable $callback
* @return \C5\AppKit\Menus\Builder
*/
public function make($name, $callback, $share = null)
{
if (is_callable($callback)) {
$menu = new Builder($name, $this->loadConfig($name), $this->html, $this->url);
call_user_func($callback, $menu);
$this->collection->put($name, $menu);
if ($share != null) {
$this->view->composer($share, function ($view) use($name, $menu) {
$view->with($name, $menu);
});
} else {
$this->view->composer($name, $menu);
}
return $menu;
}
}
示例4: composer
/**
* Register a view composer to current theme.
*
* @param string|array $views
* @param string|callable $callback
* @param int|null $priority
*/
public function composer($views, $callback, $priority = null)
{
$theViews = [];
foreach ((array) $views as $view) {
$theViews[] = $this->getThemeNamespace($view);
}
$this->views->composer($theViews, $callback, $priority);
}
示例5: handle
/**
* Handle the command.
*
* @param Application $application
* @param Factory $views
*/
public function handle(Application $application, Factory $views)
{
$views->composer('*', 'Anomaly\\Streams\\Platform\\View\\ViewComposer');
$views->addNamespace('streams', __DIR__ . '/../../../resources/views');
$views->addNamespace('resources', base_path('resources/views'));
$views->addNamespace('storage', $application->getStoragePath());
$views->addNamespace('app', $application->getResourcesPath());
$views->addNamespace('root', base_path());
$views->addExtension('html', 'php');
}
示例6: postEmail
/**
* Send a reset link to the given user.
*
* @param EmailPasswordLinkRequest $request
* @param Illuminate\View\Factory $view
* @return Response
*/
public function postEmail(EmailPasswordLinkRequest $request, Factory $view)
{
$view->composer('emails.auth.password', function ($view) {
$view->with(['title' => trans('front/password.email-title'), 'intro' => trans('front/password.email-intro'), 'link' => trans('front/password.email-link'), 'expire' => trans('front/password.email-expire'), 'minutes' => trans('front/password.minutes')]);
});
switch ($response = $this->passwords->sendResetLink($request->only('email'), function ($message) {
$message->subject(trans('front/password.reset'));
})) {
case PasswordBroker::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case PasswordBroker::INVALID_USER:
return redirect()->back()->with('error', trans($response));
}
}
示例7: postEmail
/**
* Send a reset link to the given user.
*
* @param EmailPasswordLinkRequest $request
* @param Illuminate\View\Factory $view
* @return Response
*/
public function postEmail(Factory $view)
{
$request = Request::all();
$view->composer('emails.auth.password', function ($view) {
$view->with(['title' => trans('front/password.email-title'), 'intro' => trans('front/password.email-intro'), 'link' => trans('front/password.email-link'), 'expire' => trans('front/password.email-expire'), 'minutes' => trans('front/password.minutes')]);
});
$response = Password::sendResetLink(['email' => $request['email']], function (Message $message) {
$message->subject(trans('front/password.reset'));
});
switch ($response) {
case Password::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
return redirect()->back()->with('error', trans($response));
}
}
示例8: partialComposer
/**
* Hook a partial before rendering.
*
* @param mixed $view
* @param closure $callback
* @return void
*/
public function partialComposer($view, $callback, $layout = null)
{
$partialDir = $this->getConfig('containerDir.partial');
if (!is_array($view)) {
$view = array($view);
}
// Partial path with namespace.
$path = $this->getThemeNamespace($partialDir);
// This code support partialWithLayout.
if (!is_null($layout)) {
$path = $path . '.' . $layout;
}
$view = array_map(function ($v) use($path) {
return $path . '.' . $v;
}, $view);
$this->view->composer($view, $callback);
}
示例9: composer
/**
* Register a view composer event.
*
* @param array|string $views
* @param \Closure|string $callback
* @param int|null $priority
* @return array
* @static
*/
public static function composer($views, $callback, $priority = null)
{
return \Illuminate\View\Factory::composer($views, $callback, $priority);
}
示例10: registerViewComposers
/**
* Registers the view composers for this package
*/
private function registerViewComposers()
{
$this->view->composer('auth::*', 'Ipunkt\\Auth\\Composers\\ConfigComposer');
}