'event.browse', 'create' => 'event.create', 'update' => 'event.update', 'destroy' => 'event.destroy', ]; protected $moduleSettingsLinks = [ ['route' => 'calendar.priority.index', 'label' => 'settings.priority'], ['route' => 'calendar.status.index', 'label' => 'settings.status'], ]; protected $routes = [ 'index' => 'calendar.events.index', 'create' => 'calendar.events.create', 'show' => 'calendar.events.show', 'edit' => 'calendar.events.edit', 'store' => 'calendar.events.store', 'destroy' => 'calendar.events.destroy', 'update' => 'calendar.events.update' ]; public function index(Request $request) { return redirect()->route('calendar.index'); } protected $settingsPermission = 'calendar.settings'; protected $showFields = [ 'information' => [ 'name' => [ 'type' => 'text', 'col-class' => 'col-lg-12' ], 'start_date' => [ 'type' => 'datetime', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'end_date' => [ 'type' => 'datetime', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'sharedWith' => [ 'type' => 'oneToMany', 'relation' => 'sharedWith', 'column' => 'name', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'full_day' => [ 'type' => 'checkbox', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'event_color' => [ 'type' => 'text', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'event_priority_id' => [ 'type' => 'manyToOne', 'relation' => 'eventPriority', 'column' => 'name', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'event_status_id' => [ 'type' => 'manyToOne', 'relation' => 'eventStatus', 'column' => 'name', 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'contact_id' => [ 'type' => 'manyToOne', 'relation' => 'contact', 'column' => 'full_name', 'dont_translate' => true, 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], 'lead_id' => [ 'type' => 'manyToOne', 'relation' => 'lead', 'column' => 'full_name', 'dont_translate' => true, 'col-class' => 'col-lg-6 col-md-6 col-sm-6' ], ], 'description' => [ 'description' => [ 'type' => 'text', 'col-class' => 'col-lg-12 col-md-12 col-sm-12' ], ] ]; protected $languageFile = 'calendar::events'; public function __construct() { parent::__construct(); } protected function updateNotification($entity) { if (config('bap.record_assigned_notification_enabled') && $this->updateNotifications) { if ($entity instanceof Ownable) { foreach ($entity->sharedWith as $user) { if ($user && $user->email && $user->id != Auth::user()->id) { // don't send to current user try { $commentOn = $entity->name; $commentOn = ' - ' . $commentOn; } catch (\Exception $exception) { $commentOn = ''; } $placeholder = new NotificationPlaceholder(); $placeholder->setRecipient($user); $placeholder->setAuthorUser(\Auth::user()); $placeholder->setAuthor(\Auth::user()->name); $placeholder->setColor('bg-green'); $placeholder->setIcon('assignment'); $placeholder->setContent(trans('notifications::notifications.updated_record', ['user' => \Auth::user()->name]) . $commentOn); $placeholder->setUrl(route($this->routes['show'], $entity->id)); $user->notify(new GenericNotification($placeholder)); } } if ($entity->getOwner() != null && $entity->getOwner() instanceof User) { if ($entity->getOwner()->id != \Auth::user()->id) { // Dont send notification for myself try { $commentOn = $entity->name; $commentOn = ' - ' . $commentOn; } catch (\Exception $exception) { $commentOn = ''; } $placeholder = new NotificationPlaceholder(); $placeholder->setRecipient($entity->getOwner()); $placeholder->setAuthorUser(\Auth::user()); $placeholder->setAuthor(\Auth::user()->name); $placeholder->setColor('bg-green'); $placeholder->setIcon('assignment'); $placeholder->setContent(trans('notifications::notifications.updated_record', ['user' => \Auth::user()->name]) . $commentOn); $placeholder->setUrl(route($this->routes['show'], $entity->id)); $entity->getOwner()->notify(new GenericNotification($placeholder)); } } if ($entity->getOwner() != null && $entity->getOwner() instanceof Group) { foreach ($entity->getOwner()->users as $user) { if ($user && $user->email && $user->id != Auth::user()->id) { // don't send to current user try { $commentOn = $entity->name; $commentOn = ' - ' . $commentOn; } catch (\Exception $exception) { $commentOn = ''; } $placeholder = new NotificationPlaceholder(); $placeholder->setRecipient($user); $placeholder->setAuthorUser(\Auth::user()); $placeholder->setAuthor(\Auth::user()->name); $placeholder->setColor('bg-green'); $placeholder->setIcon('assignment'); $placeholder->setContent(trans('notifications::notifications.updated_record', ['user' => \Auth::user()->name]) . $commentOn); $placeholder->setUrl(route($this->routes['show'], $entity->id)); $user->notify(new GenericNotification($placeholder)); } } } } } } }