Added user create and update events..
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Jobs\Auth;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Auth\UserCreated;
|
||||
use App\Events\Auth\UserCreating;
|
||||
use App\Models\Auth\User;
|
||||
use Artisan;
|
||||
|
||||
@@ -29,6 +31,8 @@ class CreateUser extends Job
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
event(new UserCreating($this->request));
|
||||
|
||||
\DB::transaction(function () {
|
||||
$this->user = User::create($this->request->input());
|
||||
|
||||
@@ -79,6 +83,8 @@ class CreateUser extends Job
|
||||
}
|
||||
});
|
||||
|
||||
event(new UserCreated($this->user, $this->request));
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Jobs\Auth;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Auth\UserUpdated;
|
||||
use App\Events\Auth\UserUpdating;
|
||||
use App\Models\Auth\User;
|
||||
|
||||
class UpdateUser extends Job
|
||||
@@ -38,6 +40,8 @@ class UpdateUser extends Job
|
||||
unset($this->request['password_confirmation']);
|
||||
}
|
||||
|
||||
event(new UserUpdating($this->user, $this->request));
|
||||
|
||||
\DB::transaction(function () {
|
||||
$this->user->update($this->request->input());
|
||||
|
||||
@@ -73,6 +77,8 @@ class UpdateUser extends Job
|
||||
}
|
||||
});
|
||||
|
||||
event(new UserUpdated($this->user, $this->request));
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user