add column littlelink_name to user lists and validate user edit

This commit is contained in:
aprillio 2021-07-06 15:35:32 +07:00
parent 43529efa73
commit 3a16773f5d
1 changed files with 11 additions and 4 deletions

View File

@ -38,19 +38,19 @@ class AdminController extends Controller
switch($usersType){ switch($usersType){
case 'all': case 'all':
$data['users'] = User::select('id', 'name', 'role', 'block')->get(); $data['users'] = User::select('id', 'name', 'littlelink_name', 'role', 'block')->get();
return view('panel/users', $data); return view('panel/users', $data);
break; break;
case 'user': case 'user':
$data['users'] = User::where('role', 'user')->select('id', 'name', 'role', 'block')->get(); $data['users'] = User::where('role', 'user')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
return view('panel/users', $data); return view('panel/users', $data);
break; break;
case 'vip': case 'vip':
$data['users'] = User::where('role', 'vip')->select('id', 'name', 'role', 'block')->get(); $data['users'] = User::where('role', 'vip')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
return view('panel/users', $data); return view('panel/users', $data);
break; break;
case 'admin': case 'admin':
$data['users'] = User::where('role', 'admin')->select('id', 'name', 'role', 'block')->get(); $data['users'] = User::where('role', 'admin')->select('id', 'name', 'littlelink_name', 'role', 'block')->get();
return view('panel/users', $data); return view('panel/users', $data);
break; break;
} }
@ -97,6 +97,13 @@ class AdminController extends Controller
//Save user edit //Save user edit
public function editUser(request $request) public function editUser(request $request)
{ {
$request->validate([
'name' => 'required',
'email' => 'required',
'password' => 'required',
'littlelink_name' => 'required',
]);
$id = $request->id; $id = $request->id;
$name = $request->name; $name = $request->name;
$email = $request->email; $email = $request->email;