/** * Handle the event. * * @param SubscriptionDeleted $event * @return void */ public function handle(SubscriptionDeleted $event) { // Stop event propagation if subscription does not exists if (!$event->userId) { return false; } UserActions::info($event->userId, 'Subscription with id ' . $event->subscription['id'] . ' was deleted.'); }
/** * Handle the event. * * @param UserDeletedBill $event * @return void */ public function handle(UserDeletedBill $event) { UserActions::allowed($event->userId, 'Deleted bill with id ' . $event->billId . '.'); }
/** * Handle the event. * * @param UserLoggedIn $event * @return void */ public function handle(UserLoggedIn $event) { UserActions::allowed($event->userId, 'Logged in.'); }
/** * Handle the event. * * @param FailedLogIn $event * @return void */ public function handle(FailedLogIn $event) { UserActions::wrongFormat($event->userId, 'Failed login attempt.'); // todo Save login attempts also in another place to implement brute force protection }
/** * Handle the event. * * @param UserCreatedNewBill $event * @return void */ public function handle(UserCreatedNewBill $event) { UserActions::allowed($event->userId, 'Created new bill with id ' . $event->billId); }
/** * Handle the event. * * @param UserLoggedOut $event * @return void */ public function handle(UserLoggedOut $event) { UserActions::allowed($event->userId, 'Logged out.'); }
/** * Paginate user actions. * * @param int $userId * @param string $type * @return mixed */ public function getUserActions($userId, $type) { // Make sure user id exists in database if (!User::where('id', $userId)->count()) { $response = new AjaxResponse(); $response->setFailMessage(trans('users_manager.user_not_found')); return response($response->get(), $response->badRequest())->header('Content-Type', 'application/json'); } // Paginate allowed user actions if ($type === 'allowed') { return UserActions::getAllowed($userId); } // Paginate info user actions if ($type === 'info') { return UserActions::getInfo($userId); } // Paginate wrong format user actions if ($type === 'wrong_format') { return UserActions::getWrongFormat($userId); } // Paginate not allowed user actions if ($type === 'not_allowed') { return UserActions::getNotAllowed($userId); } // By default return all user actions return UserActions::getAll($userId); }
/** * Handle the event. * * @param SubscriptionCreated $event * @return void */ public function handle(SubscriptionCreated $event) { UserActions::info($event->userId, 'Subscription with id ' . $event->subscription['id'] . ' was created.'); }
/** * Handle the event. * * @param HomepageAccessed $event * @return void */ public function handle(HomepageAccessed $event) { UserActions::allowed($event->userId, 'Requested ajax pagination of their bills.'); }
/** * Handle the event. * * @param SubscriptionSucceeded $event * @return void */ public function handle(SubscriptionSucceeded $event) { UserActions::info($event->userId, 'Subscription with id ' . $event->subscription['id'] . ' succeeded.'); }