Exemplo n.º 1
0
 public function update(Request $request, PersonModel $person)
 {
     $person->setName($request->input('name'))->setEnabled($request->has('enabled'));
     if (Gate::allows('editSuperuser', $person)) {
         $person->setSuperuser($request->has('superuser'));
     }
     PersonFacade::save($person);
 }
Exemplo n.º 2
0
 public function __construct()
 {
     if (!Gate::allows('manage-university')) {
         abort(403);
     }
     $this->middleware('auth');
     if (auth()->check()) {
         $this->university = auth()->user()->university;
     }
 }
 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.social'), function (SidebarGroup $group) {
         $group->addItem(trans('reasons::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.reasons.sidebar.icon');
             $item->weight = config('typicms.reasons.sidebar.weight');
             $item->route('admin::index-reasons');
             $item->append('admin::create-reason');
             $item->authorize(Gate::allows('index-reasons'));
         });
     });
 }
 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.content'), function (SidebarGroup $group) {
         $group->addItem(trans('blocks::global.name'), function (SidebarItem $item) {
             $item->id = 'blocks';
             $item->icon = config('typicms.blocks.sidebar.icon', 'icon fa fa-fw fa-list-alt');
             $item->weight = config('typicms.blocks.sidebar.weight');
             $item->route('admin::index-blocks');
             $item->append('admin::create-block');
             $item->authorize(Gate::allows('index-blocks'));
         });
     });
 }
 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.media'), function (SidebarGroup $group) {
         $group->addItem(trans('files::global.name'), function (SidebarItem $item) {
             $item->id = 'files';
             $item->icon = config('typicms.files.sidebar.icon', 'icon fa fa-fw fa-file-photo-o');
             $item->weight = config('typicms.files.sidebar.weight');
             $item->route('admin::index-files');
             $item->append('admin::create-file');
             $item->authorize(Gate::allows('index-files'));
         });
     });
 }
 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.newsletter'), function (SidebarGroup $group) {
         $group->id = 'newsletter';
         $group->weight = 20;
         $group->addItem(trans('newsletter::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.newsletter.sidebar.icon', 'icon fa fa-fw fa-envelope');
             $item->weight = config('typicms.newsletter.sidebar.weight');
             $item->route('admin::index-newsletter');
             $item->append('admin::create-newsletter');
             $item->authorize(Gate::allows('newsletter.index'));
         });
     });
 }
 public function compose(View $view)
 {
     $view->sidebar->group(trans('global.menus.shop'), function (SidebarGroup $group) {
         $group->id = 'shop';
         $group->weight = 2;
         $group->addItem(trans('attributes::global.name'), function (SidebarItem $item) {
             $item->icon = config('typicms.attributes.sidebar.icon');
             $item->weight = config('typicms.attributes.sidebar.weight');
             $item->route('admin::index-attribute_groups');
             $item->append('admin::create-attribute_group');
             $item->authorize(Gate::allows('index-attribute_groups'));
         });
     });
 }
Exemplo n.º 8
0
 public function index()
 {
     $model = new Order();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Order ID'));
     $dataGrid->addColumn(DataGrid::textColumn('shipping_method', 'Shipping Method'));
     $dataGrid->addColumn(DataGrid::textColumn('payment_method', 'Payment Method'));
     $dataGrid->addColumn(DataGrid::textColumn('order_status_title', 'Order Status'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order.view"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('view', 'View', function ($row) {
             return "<a href='" . route('admin.order.view', $row->id) . "'>View</a>";
         }));
     }
     return view('admin.order.index')->with('dataGrid', $dataGrid);
 }
 public function compose(View $view)
 {
     $view->sidebar->group('dashboard', function (SidebarGroup $group) {
         $group->id = 'dashboard';
         $group->weight = 10;
         $group->hideHeading();
         $group->addItem(trans('dashboard::global.name'), function (SidebarItem $item) {
             $item->id = 'dashboard';
             $item->icon = config('typicms.dashboard.sidebar.icon', 'icon fa fa-fw fa-dashboard');
             $item->weight = config('typicms.dashboard.sidebar.weight');
             $item->route('dashboard');
             $item->authorize(Gate::allows('dashboard'));
         });
     });
 }
Exemplo n.º 10
0
 /**
  * build frontend menu and attach it to view.
  */
 private function registerFrontendMenu()
 {
     $this->app->singleton('menu.frontend', function () {
         return Menu::create('frontend');
     });
     View::composer('vain::app', function ($view) {
         $handler = app('menu.frontend');
         $view->with('menu', $handler);
         // inject home item
         $handler->addChild('Home')->setUri(route('index.home'))->setExtra('icon', 'home');
         if (Gate::allows('app.admin.show')) {
             $handler->addChild('Admin Panel')->setUri(route('user.admin.users.index'))->setExtra('icon', 'tachometer');
         }
         Event::fire(new FrontendMenuCreated($handler, $view));
     });
 }
Exemplo n.º 11
0
 /**
  * Teardown block setup
  */
 public static function tearDown()
 {
     $html = ob_get_clean();
     end(self::$models);
     $slug = key(self::$models);
     $title = array_pop(self::$models);
     /** @var Block $block */
     $block = Block::where('slug', $slug)->first();
     if (!$block) {
         $block = new Block(['slug' => $slug, 'title' => $title, 'content' => trim($html)]);
         $block->save();
     }
     if (Gate::allows('edit-html-blocks')) {
         return sprintf('<html-block slug="%s">%s</html-block>', $slug, trim($block->content));
     }
     return trim($block->content);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new TaskStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Status Name', ['sortable' => 'asc']));
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('setup.task-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "setup.task-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('setup.task-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('setup.task-status.index')->with('dataGrid', $dataGrid);
 }
Exemplo n.º 13
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $role = new Role();
     $dataGrid = DataGrid::make($role);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Role Name'));
     $dataGrid->addColumn(DataGrid::textColumn('description', 'Role Description'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.role.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.role.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.role.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.user.role.index')->with('dataGrid', $dataGrid);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $model = new OrderStatus();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Order ID'));
     $dataGrid->addColumn(DataGrid::textColumn('title', 'Title'));
     $dataGrid->addColumn(DataGrid::textColumn('is_default', 'Is Default'));
     $dataGrid->addColumn(DataGrid::textColumn('is_last_stage', 'Is Last Stage'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.order-status.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.order-status.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.order-status.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.order-status.index')->with('dataGrid', $dataGrid);
 }
Exemplo n.º 15
0
 /**
  * Returns a table of all labels.
  *
  * @param Label $label
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function table(Label $label)
 {
     return $this->table->of('labels', function (TableGrid $table) use($label) {
         $table->with($label)->paginate($this->perPage);
         $table->sortable(['name']);
         $table->column('name', function (Column $column) {
             $column->label = 'Label';
             $column->value = function (Label $label) {
                 return $label->display_large;
             };
         });
         $table->column('issues', function (Column $column) {
             $column->label = 'Open Issues';
             $column->headers = ['class' => 'hidden-xs'];
             $column->value = function (Label $label) {
                 return $label->issues()->open()->count();
             };
             $column->attributes = function () {
                 return ['class' => 'hidden-xs'];
             };
         });
         // Check if the current user has access to edit
         // labels before rendering the label as a link.
         if (Gate::allows('labels.edit')) {
             $table->column('edit', function (Column $column) {
                 $column->value = function (Label $label) {
                     return link_to_route('labels.edit', 'Edit', [$label->id], ['class' => 'btn btn-xs btn-warning']);
                 };
             });
         }
         // Check if the current user has access to delete
         // labels before rendering the delete column.
         if (Gate::allows('labels.destroy')) {
             $table->column('delete', function (Column $column) {
                 $column->value = function (Label $label) {
                     return link_to_route('labels.destroy', 'Delete', [$label->id], ['data-post' => 'DELETE', 'data-title' => 'Delete Label?', 'data-message' => 'Are you sure you want to delete this label?', 'class' => 'btn btn-xs btn-danger']);
                 };
             });
         }
     });
 }
Exemplo n.º 16
0
 public function index()
 {
     $model = new Review();
     $dataGrid = DataGrid::make($model);
     $dataGrid->addColumn(DataGrid::textColumn('id', 'Id'));
     $dataGrid->addColumn(DataGrid::textColumn('user_name', 'User Name'));
     $dataGrid->addColumn(DataGrid::textColumn('product_title', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('star', 'Product Title'));
     $dataGrid->addColumn(DataGrid::textColumn('status', 'Status'));
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('admin.review.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "admin.review.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('admin.review.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     return view('admin.review.index')->with('dataGrid', $dataGrid);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $projects = Project::paginate(10);
     $project = new Project();
     $dataGrid = DataGrid::make($project);
     $dataGrid->addColumn(DataGrid::textColumn('name', 'Project Name', ['sortable' => 'asc']));
     $dataGrid->addColumn(DataGrid::textColumn('description', 'Project Description'));
     if (Gate::allows('hasPermission', [AdminUser::class, "project.edit"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('edit', 'Edit', function ($row) {
             return "<a href='" . route('project.edit', $row->id) . "'>Edit</a>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "project.destroy"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('destroy', 'Destroy', function ($row) {
             return "<form method='post' action='" . route('project.destroy', $row->id) . "'>" . "<input type='hidden' name='_method' value='delete'/>" . csrf_field() . '<a href="#" onclick="jQuery(this).parents(\'form:first\').submit()">Destroy</a>' . "</form>";
         }));
     }
     if (Gate::allows('hasPermission', [AdminUser::class, "project.show"])) {
         $dataGrid->addColumn(DataGrid::linkColumn('show', 'Show', function ($row) {
             return "<a href='" . route('project.show', $row->id) . "'>Show</a>";
         }));
     }
     return view('project.project.index')->with('dataGrid', $dataGrid);
 }
Exemplo n.º 18
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Gate::allows('manage-university');
 }
 public function showTickets()
 {
     $tickets = Ticket::all()->filter(function ($ticket) {
         return Gate::allows('view-ticket', $ticket);
     });
     return view('helpdesk/manyTickets', compact('tickets'));
 }
Exemplo n.º 20
0
 public function deleteUser(Request $request, $userid)
 {
     if (Gate::allows('deleteUser', $userid)) {
         User::destroy($userid);
         return response(200);
     } else {
         return response("Unauthorised.", 401);
     }
 }
Exemplo n.º 21
0
 /**
  * Whether the user has the 'managePages' role.
  *
  * @return bool
  */
 protected function managesPages()
 {
     return Gate::allows('managePages', Router::getActiveSite()) === true;
 }
Exemplo n.º 22
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Auth::check() && Gate::allows('is-student');
 }
Exemplo n.º 23
0
 public function postSearch(Request $request, Page $page)
 {
     $this->authorize('editSearchBasic', $page);
     $page->setDescription($request->input('description'))->setKeywords($request->input('keywords'));
     if (Gate::allows('editSearchAdvanced', $page)) {
         $page->setExternalIndexing($request->has('external_indexing'))->setInternalIndexing($request->has('internal_indexing'));
     }
     PageFacade::save($page);
     Event::fire(new Events\PageSearchSettingsWereUpdated($page));
 }
Exemplo n.º 24
0
 public function store(Request $request)
 {
     $regras = array('email' => 'required|string', 'nome' => 'required', 'perfis' => 'required|min:1');
     $mensagens = array('required' => 'O campo :attribute deve ser preenchido.', 'perfis.min' => 'O campo perfil deve ser selecionado.');
     $validator = Validator::make($request->all(), $regras, $mensagens);
     if ($validator->fails()) {
         return redirect('Usuario/cadastrar')->withErrors($validator)->withInput();
     }
     $perfil = PerfilUsuario::where('id', '=', $request['perfis'])->first();
     $usuarioLogado = Auth::User()->load('Vendedor');
     if (Gate::allows('AcessoVendedor') && $perfil->tipo == 'Vendedor') {
         DB::beginTransaction();
         try {
             $senha = rand(100000, 999999);
             $usuario = User::create(['name' => $request['nome'], 'email' => $request['email'], 'password' => Hash::make($request['password']), 'idPerfilUsuario' => $request['perfis']]);
             Mail::send('Usuario.EmailTemplate', ['email' => $usuario->email, 'password' => $senha], function ($message) use($usuario) {
                 $message->to($usuario->email, $usuario->name)->subject('BrasilSpot Login');
             });
             if ($perfil->tipo == 'Vendedor') {
                 $regras = array('tiposVendedores' => 'required|min:1', 'metas' => 'required|min:1');
                 $mensagens = array('tiposVendedores.required' => 'O campo Tipos De Vendedores deve ser selecionado.', 'tiposVendedores.min' => 'O campo Tipos De Vendedores deve ser selecionado.', 'metas.required' => 'O campo Metas deve ser selecionado.', 'metas.min' => 'O campo Metas deve ser selecionado.');
                 $validator = Validator::make($request->all(), $regras, $mensagens);
                 if ($validator->fails()) {
                     return redirect('Usuario/cadastrar')->withErrors($validator)->withInput();
                 }
                 $vendedor = Vendedor::create(['idUsuario' => $usuario->id, 'idTipo' => $request['tiposVendedores'], 'idMeta' => $request['metas'], 'idVendedorPai' => $usuarioLogado->id]);
             }
         } catch (Exception $exception) {
             DB::rollBack();
             $errors = $validator->getMessageBag();
             $errors->add('ErroException', 'Não foi possivel cadastrar o usuario.');
             return redirect()->back();
         }
         DB::commit();
         Session::flash('flash_message', 'Usuário adicionada com sucesso!');
         return redirect()->back();
     } else {
         if (Gate::allows('AcessoVendedor') && $perfil->tipo == 'Comerciante') {
             DB::beginTransaction();
             try {
                 $senha = rand(100000, 999999);
                 $usuario = User::create(['name' => $request['nome'], 'email' => $request['email'], 'password' => Hash::make($senha), 'idPerfilUsuario' => $request['perfis']]);
                 Comerciante::create(['idVendedor' => $usuarioLogado->Vendedor->id, 'idUsuario' => $usuario->id]);
                 Mail::send('Usuario.EmailTemplate', ['email' => $usuario->email, 'password' => $senha], function ($message) use($usuario) {
                     $message->to($usuario->email, $usuario->name)->subject('BrasilSpot Login');
                 });
             } catch (Exception $exception) {
                 DB::rollBack();
                 $errors = $validator->getMessageBag();
                 $errors->add('ErroException', 'Não foi possivel cadastrar o usuario.');
                 return redirect()->back();
             }
             DB::commit();
             Session::flash('flash_message', 'Usuário adicionada com sucesso!');
             return redirect()->back();
         }
     }
     return redirect()->back();
 }
Exemplo n.º 25
0
 /**
  * Edit button.
  *
  * @param string $type
  * @param int    $id
  *
  * @return string
  */
 public function editBtn($type = null, $id = null)
 {
     if (Gate::allows('quarx', Auth::user())) {
         if (!is_null($id)) {
             return '<a href="' . url('quarx/' . $type . '/' . $id . '/edit') . '" class="btn btn-xs btn-default pull-right"><span class="fa fa-pencil"></span> Edit</a>';
         } else {
             return '<a href="' . url('quarx/' . $type) . '" class="btn btn-xs btn-default pull-right"><span class="fa fa-pencil"></span> Edit</a>';
         }
     }
     return '';
 }
Exemplo n.º 26
0
 public function deleteCache()
 {
     if (Gate::allows('mod-qdn', $this->qdn->slug)) {
         Cache::forget($this->qdn->slug);
     }
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Gate::allows('create', new Entity());
 }
Exemplo n.º 28
0
 public function getDataViewAssets($categoryID)
 {
     $category = Category::with('assets.company')->find($categoryID);
     $category_assets = $category->assets();
     if (Input::has('search')) {
         $category_assets = $category_assets->TextSearch(e(Input::get('search')));
     }
     if (Input::has('offset')) {
         $offset = e(Input::get('offset'));
     } else {
         $offset = 0;
     }
     if (Input::has('limit')) {
         $limit = e(Input::get('limit'));
     } else {
         $limit = 50;
     }
     $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
     $allowed_columns = ['id', 'name', 'serial', 'asset_tag'];
     $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
     $count = $category_assets->count();
     $category_assets = $category_assets->skip($offset)->take($limit)->get();
     $rows = array();
     foreach ($category_assets as $asset) {
         $actions = '';
         $inout = '';
         if ($asset->deleted_at == '') {
             $actions = '<div style=" white-space: nowrap;"><a href="' . route('clone/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="' . route('update/hardware', $asset->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware', $asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
         } elseif ($asset->deleted_at != '') {
             $actions = '<a href="' . route('restore/hardware', $asset->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
         }
         if ($asset->availableForCheckout()) {
             if (Gate::allows('assets.checkout')) {
                 $inout = '<a href="' . route('checkout/hardware', $asset->id) . '" class="btn btn-info btn-sm">' . trans('general.checkout') . '</a>';
             }
         } else {
             if (Gate::allows('assets.checkin')) {
                 $inout = '<a href="' . route('checkin/hardware', $asset->id) . '" class="btn btn-primary btn-sm">' . trans('general.checkin') . '</a>';
             }
         }
         $rows[] = array('id' => $asset->id, 'name' => (string) link_to('/hardware/' . $asset->id . '/view', $asset->showAssetName()), 'model' => $asset->model->name, 'asset_tag' => $asset->asset_tag, 'serial' => $asset->serial, 'assigned_to' => $asset->assigneduser ? (string) link_to('/admin/users/' . $asset->assigneduser->id . '/view', $asset->assigneduser->fullName()) : '', 'change' => $inout, 'actions' => $actions, 'companyName' => Company::getName($asset));
     }
     $data = array('total' => $count, 'rows' => $rows);
     return $data;
 }
Exemplo n.º 29
0
 /**
  * @author Casper Rasmussen <*****@*****.**>
  * @param \Nodes\Backend\Models\User\Validation\UserValidator $userValidator
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(UserValidator $userValidator)
 {
     // Retrieve posted data
     $data = Request::all();
     // Retrieve user to update
     $user = $this->userRepository->getById($data['id']);
     if (empty($user)) {
         return redirect()->route('nodes.backend.users')->with('error', 'User was not found');
     }
     // Make sure user has access to edit this user
     if (Gate::denies('backend-edit-backend-user', $user)) {
         abort(403);
     }
     // Validate user
     if (!$userValidator->with($data)->validate()) {
         return redirect()->back()->withInput()->with(['error' => $userValidator->errorsBag()]);
     }
     // Retrieve available roles for users user-role,
     // and make sure that the selected role is within
     // the access level of the authed user.
     //
     // Otherwise remove "user_role" from the array of data
     // we're about to update on the user
     $roles = $this->roleRepository->getListUserLevel();
     if (empty($roles[$data['user_role']])) {
         unset($data['user_role']);
     }
     // Update user and redirect
     try {
         $this->userRepository->updateUser($user, $data);
         // Only admins have access to list of users, users need to go to
         return Gate::allows('backend-admin') ? redirect()->route('nodes.backend.users')->with('success', 'User was successfully updated') : redirect()->route(config('nodes.backend.auth.routes.success'))->with('success', 'User was successfully updated');
     } catch (Exception $e) {
         return redirect()->back()->withInput()->with('error', 'Could not update user');
     }
 }
Exemplo n.º 30
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return Gate::allows('create-module');
 }