/** * Create a new event instance. * * @return void */ public function __construct() { Event::listen('auth.login', function ($event) { UsersLogs::create(['user_id' => Auth::user()->id, 'action' => 'login']); }); Event::listen('auth.logout', function ($event) { UsersLogs::create(['user_id' => Auth::user()->id, 'action' => 'logout']); }); }
public function table() { return Datatables::of(UsersLogs::with('users')->orderBy('id', 'desc'))->make(true); }
public function deleting($model) { UsersLogs::create(['user_id' => Auth::user()->id, 'action' => 'deleted', 'action_model' => $model->getTable(), 'action_id' => $model->id]); }