<?php namespace App\Http\Controllers\Admin; use App\Models\AdminUser; use App\Http\Requests\Admin\AdminuserRequest; class AdminusersController extends Controller { public function getIndex() { $users = AdminUser::where(‘role‘, ‘adminer‘) ->where(‘id‘, ‘!=‘, 1) ->paginate(8); return view(‘admin.admin_users.index‘, compact(‘users‘)); } public function getData(AdminUser $users) { $users->mergeAttributesOld(); return view(‘admin.admin_users.edit‘, compact(‘users‘)); } public function getEdit($id) { $users = AdminUser::findOrFail($id); return view(‘admin.admin_users.edit‘, compact(‘users‘)); } public function postStore(AdminuserRequest $request) { $data = $request->getData(); $data[‘role‘] = ‘adminer‘; AdminUser::create($data); return redirect()->action(‘Admin\[email protected]‘); } public function postUpdate(AdminuserRequest $request, $id) { $data = $request->getData(); $users = AdminUser::findOrFail($id); $users->update($data); return redirect()->action(‘Admin\[email protected]‘); } public function deleteAdminUser($id) { AdminUser::findOrFail($id)->delete(); return redirect()->action(‘Admin\[email protected]‘); } }
时间: 2024-11-06 09:41:24