Ejemplo n.º 1
0
 /**
  * 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());
     });
 }
Ejemplo n.º 2
0
 /**
  * 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());
     });
 }
Ejemplo n.º 3
0
 /**
  * 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;
     }
 }
Ejemplo n.º 4
0
 /**
  * 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);
 }
 /**
  * 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');
 }
 /**
  * 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));
     }
 }
Ejemplo n.º 7
0
 /**
  * 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));
     }
 }
Ejemplo n.º 8
0
 /**
  * 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);
 }
Ejemplo n.º 9
0
 /**
  * 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);
 }
Ejemplo n.º 10
0
 /**
  * Registers the view composers for this package
  */
 private function registerViewComposers()
 {
     $this->view->composer('auth::*', 'Ipunkt\\Auth\\Composers\\ConfigComposer');
 }