mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
User Listener
This commit is contained in:
parent
f3994f4a07
commit
ab07513e3d
40
app/Listeners/User/CreatedUserActivity.php
Normal file
40
app/Listeners/User/CreatedUserActivity.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\User;
|
||||
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class CreatedUserActivity
|
||||
{
|
||||
protected $activityRepo;
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ActivityRepository $activityRepo)
|
||||
{
|
||||
$this->activityRepo = $activityRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->user_id = auth()->user()->id;
|
||||
$fields->company_id = $event->user->company_id;
|
||||
$fields->activity_type_id = Activity::CREATE_USER;
|
||||
|
||||
$this->activityRepo->save($fields, $event->user);
|
||||
}
|
||||
}
|
@ -52,13 +52,18 @@ class Activity extends BaseModel
|
||||
const DELETE_TASK=45;
|
||||
const RESTORE_TASK=46;
|
||||
const UPDATE_EXPENSE=47;
|
||||
const CREATE_USER=48;
|
||||
const UPDATE_USER=49;
|
||||
const ARCHIVE_USER=50;
|
||||
const DELETE_USER=51;
|
||||
const RESTORE_USER=52;
|
||||
|
||||
|
||||
public function backup()
|
||||
{
|
||||
return $this->hasOne(Backup::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user