芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/app/Http/Controllers/Admin/UserController.php
search ?: ''; $data['sort']['column'] = $request->sort['column'] ?? 'name'; $data['sort']['order'] = $request->sort['order'] ?? 'asc'; $data['users'] = $repositories->paginateSearchResult($data['search'], $data['sort']); return Inertia::render('Users/Index', $data); } /** * Create user */ public function create(): Response { $data['roles'] = Role::all(); return Inertia::render('Users/Create', $data); } /** * Create user */ public function store(UserStoreRequest $request, UserRepositories $repositories): RedirectResponse { $repositories->store($request); return redirect()->route('admin.users.index')->with('success', 'User successfully created'); } /** * Edit user */ public function edit(User $user): Response { $data['user'] = $user; $data['roles'] = Role::all(); return Inertia::render('Users/Edit', $data); } /** * User update */ public function update(UserUpdateRequest $request, User $user, UserRepositories $repositories): RedirectResponse { $repositories->update($user, $request); return redirect()->route('admin.users.index')->with('success', 'User successfully updated'); } /** * Delete user */ public function destroy(User $user, UserRepositories $repositories): RedirectResponse { try { $repositories->destroy($user); return back()->with('success', 'User successfully deleted'); } catch (\Exception $exception) { return back()->with('error', $exception->getMessage()); } } /** * Bulk delete */ public function bulkDelete(Request $request, UserRepositories $repositories): RedirectResponse { $repositories->bulkDelete($request); return back()->with('success', 'Selected user successfully deleted'); } }