Example #1
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->bind('widget', function ($id) use($router) {
         if ($router->is('administrator*')) {
             return Widget::withoutGlobalScope('menu_assignment')->findOrFail($id);
         }
         return Widget::findOrFail($id);
     });
     $this->mapWebRoutes($router);
 }
Example #2
0
 /**
  * Get widget custom parameter form if any.
  *
  * @param int $id
  * @param int $widget
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
  */
 public function parameters($id, $widget)
 {
     $widget = Widget::withoutGlobalScope('menu_assignment')->findOrNew($widget);
     $extension = $this->repository->findOrFail($id);
     $formView = $extension->param('form');
     if (view()->exists($formView)) {
         return view($formView, compact('widget'));
     }
     return view('widgets.partials.none');
 }