Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $validator = Validator::make($request->all(), ['row' => 'numeric', 'col' => 'numeric', 'sizex' => 'numeric', 'sizey' => 'numeric']);
     if ($validator->fails()) {
         return $validator->messages()->toJson();
     }
     $menuWidget = MenuWidget::find($id);
     if (isset($request->row)) {
         $menuWidget->row = $request->row;
     }
     if (isset($request->col)) {
         $menuWidget->col = $request->col;
     }
     if (isset($request->sizex)) {
         $menuWidget->sizex = $request->sizex;
     }
     if (isset($request->sizey)) {
         $menuWidget->sizey = $request->sizey;
     }
     $menuWidget->save();
 }
Esempio n. 2
0
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
/*
 * AUTH ROUTES END
 */
$menus = \App\Menu::All();
foreach ($menus as $menu) {
    if ($menu->parentMenu != 0) {
        $parentMenu = $menu->parentMenuModel;
        $path = $parentMenu->target . $menu->target;
    } else {
        $path = $menu->target;
    }
    if ($menu->type == 'dashboard') {
        Route::get($path, ['middleware' => 'auth', function () use($menu) {
            $userId = Auth::id();
            $widgetsMenu = \App\MenuWidget::where(array('menu' => $menu->id, 'user' => $userId))->get();
            $view = view('menuDashboard', ['menuWidgets' => $widgetsMenu, 'activMenu' => $menu->id]);
            return $view;
        }]);
    } else {
        if ($menu->type == 'singlePage') {
            $target = str_replace("/", "", $menu->target);
            Route::resource($path, $target . 'Controller');
            Route::put($path . "/{Menus}/quick_update", $target . 'Controller@postQuickUpdate');
            Route::get('API' . $path, $target . 'Controller@listAll');
        }
    }
}
Route::any('/', function () {
    $tasks = Task::orderBy('created_at', 'asc')->get();
    $view = view('tasks', ['tasks' => $tasks]);