/**
  * Handle loading the dashboard widgets.
  *
  * @param DashboardBuilder $builder
  * @return array
  */
 public function handle(DashboardBuilder $builder)
 {
     $module = $this->modules->active();
     $builder->setWidgets(array_map(function (Extension $widget) {
         return $widget->getProvides();
     }, $this->extensions->search($module->getNamespace('widget.*'))->all()));
 }
 /**
  * Build the widgets.
  *
  * @param DashboardBuilder $builder
  */
 public function build(DashboardBuilder $builder)
 {
     $dashboard = $builder->getDashboard();
     $this->input->read($builder);
     foreach ($builder->getWidgets() as $widget) {
         $dashboard->addWidget($this->factory->make($widget));
     }
 }
 /**
  * Handle the command.
  *
  * @param ModuleCollection $modules
  */
 public function handle(ModuleCollection $modules)
 {
     if ($this->builder->getDashboardOption('dashboard_view')) {
         return;
     }
     if ($module = $modules->active()) {
         $this->builder->setDashboardOption('dashboard_view', $module->getNamespace('admin/dashboard'));
     }
 }
 /**
  * Normalize widget input.
  *
  * @param DashboardBuilder $builder
  */
 public function normalize(DashboardBuilder $builder)
 {
     $widgets = $builder->getWidgets();
     foreach ($widgets as &$widget) {
         /**
          * If the widget is a a string and there is no slug
          * then use the widget as the widget parameter.
          */
         if (is_string($widget)) {
             $widget = compact('widget');
         }
     }
     $builder->setWidgets($widgets);
 }
 /**
  * Display the default dashboard.
  *
  * @param DashboardBuilder $dashboard
  * @return \Illuminate\View\View
  */
 public function index(DashboardBuilder $dashboard)
 {
     return $dashboard->render();
 }
 /**
  * Resolve the dashboard widgets.
  *
  * @param DashboardBuilder $builder
  */
 public function resolve(DashboardBuilder $builder)
 {
     $this->resolver->resolve($builder->getWidgets(), compact('builder'));
 }