Merge branch 'main' of https://git.probindo.com/Probindo/database-pertani-web
This commit is contained in:
@@ -179,11 +179,11 @@ class ProfileController extends Controller
|
|||||||
abort(403, 'Unauthorized');
|
abort(403, 'Unauthorized');
|
||||||
}
|
}
|
||||||
|
|
||||||
$emailRule = Rule::unique('users', 'email')->ignore($profile->user_id);
|
// $emailRule = Rule::unique('users', 'email')->ignore($profile->user_id);
|
||||||
|
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'nama' => ['required', 'string', 'max:255'],
|
'nama' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'email', 'max:255', $emailRule],
|
'email' => ['required', 'email', 'max:255'],// $emailRule],
|
||||||
'telepon' => ['nullable', 'string'],
|
'telepon' => ['nullable', 'string'],
|
||||||
'alamat' => ['nullable', 'string'],
|
'alamat' => ['nullable', 'string'],
|
||||||
'kk' => ['nullable', 'string'],
|
'kk' => ['nullable', 'string'],
|
||||||
@@ -205,16 +205,23 @@ class ProfileController extends Controller
|
|||||||
$validated['path_ktp'] = $ktpPath;
|
$validated['path_ktp'] = $ktpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
$validated['updated_by'] = $user->id();
|
$validated['updated_by'] = $user->id;
|
||||||
|
|
||||||
DB::transaction(function () use ($profile, $user, $validated) {
|
DB::transaction(function () use ($profile, $user, $validated) {
|
||||||
$profile->update($validated);
|
$profile->update($validated);
|
||||||
$user->update([
|
// this user
|
||||||
|
$profile->user->update([
|
||||||
'name' => $validated['nama'],
|
'name' => $validated['nama'],
|
||||||
'email' => $validated['email'],
|
'email' => $validated['email'],
|
||||||
'email_verified_at' => $validated['email_verified_at'],
|
'email_verified_at' => $validated['email_verified_at'] ?? null,
|
||||||
'updated_by' => $user->id,
|
'updated_by' => auth()->id(),
|
||||||
]);
|
]);
|
||||||
|
// $user->update([
|
||||||
|
// 'name' => $validated['nama'],
|
||||||
|
// 'email' => $validated['email'],
|
||||||
|
// 'email_verified_at' => $validated['email_verified_at'] ?? null,
|
||||||
|
// 'updated_by' => $user->id,
|
||||||
|
// ]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return response()->json($profile);
|
return response()->json($profile);
|
||||||
|
|||||||
Reference in New Issue
Block a user