本文整理汇总了PHP中Illuminate\View\Factory::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::with方法的具体用法?PHP Factory::with怎么用?PHP Factory::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\Factory
的用法示例。
在下文中一共展示了Factory::with方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
});
}
示例2: 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());
});
}
示例3: 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));
}
}
示例4: 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));
}
}