mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge pull request #12599 from inietov/fixes/unknown_column_0_in_field_list
Fixed Column not found: 1054 Unknown column '0' in 'field list' [sc-20004]
This commit is contained in:
commit
dfd9fcc5e0
|
@ -20,6 +20,7 @@ use Auth;
|
|||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\ImageUploadRequest;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
|
@ -457,6 +458,13 @@ class UsersController extends Controller
|
|||
|
||||
// Check if the request has groups passed and has a value
|
||||
if ($request->filled('groups')) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'groups.*' => 'integer|exists:permission_groups,id',
|
||||
]);
|
||||
|
||||
if ($validator->fails()){
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, $user->getErrors()));
|
||||
}
|
||||
$user->groups()->sync($request->input('groups'));
|
||||
// The groups field has been passed but it is null, so we should blank it out
|
||||
} elseif ($request->has('groups')) {
|
||||
|
|
Loading…
Reference in a new issue