added db transaction to jobs
This commit is contained in:
@ -38,24 +38,24 @@ class UpdateUser extends Job
|
||||
unset($this->request['password_confirmation']);
|
||||
}
|
||||
|
||||
$this->user->update($this->request->input());
|
||||
\DB::transaction(function () {
|
||||
$this->user->update($this->request->input());
|
||||
|
||||
// Upload picture
|
||||
if ($this->request->file('picture')) {
|
||||
$media = $this->getMedia($this->request->file('picture'), 'users');
|
||||
// Upload picture
|
||||
if ($this->request->file('picture')) {
|
||||
$media = $this->getMedia($this->request->file('picture'), 'users');
|
||||
|
||||
$this->user->attachMedia($media, 'picture');
|
||||
}
|
||||
$this->user->attachMedia($media, 'picture');
|
||||
}
|
||||
|
||||
// Sync roles
|
||||
if ($this->request->has('roles')) {
|
||||
$this->user->roles()->sync($this->request->get('roles'));
|
||||
}
|
||||
if ($this->request->has('roles')) {
|
||||
$this->user->roles()->sync($this->request->get('roles'));
|
||||
}
|
||||
|
||||
// Sync companies
|
||||
if ($this->request->has('companies')) {
|
||||
$this->user->companies()->sync($this->request->get('companies'));
|
||||
}
|
||||
if ($this->request->has('companies')) {
|
||||
$this->user->companies()->sync($this->request->get('companies'));
|
||||
}
|
||||
});
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
|
Reference in New Issue
Block a user