Menu

## EventsController extends Controller
in package
uses SendPushNotification, ReminderProcess, EventProcess, LogActivity, Common

EventsController.php : 51

Class EventsController

Handles creation, update, approval, listing, calendar rendering, notifications, and recurring logic for school events.

### Table of Contents

#### Methods

adminBirthdayReminder() : void
  Notify admins about a user's birthday via all channels.
changeevent() : void
  Update event dates via calendar drag/drop.
createReminder() : void
  Create a reminder entry for later dispatch.
destroy() : RedirectResponse|null
  Delete an event.
details() : array<string|int, mixed>
  Fetch event details for modal display with permission check.
doActivityLog() : mixed
  Fetches the activities of the logged in users.
edit() : AnonymousResourceCollection
  Fetch event data for editing.
eventapprove() : RedirectResponse
  Approve an event and trigger notifications.
eventImagePath() : string|null
  Resolve default event image path by category.
events() : array<string|int, mixed>
  Fetch all events including repeated occurrences.
fileUpload() : string
  Write raw file contents to storage.
getDailyTasks() : array<string|int, mixed>
  Generate daily repeating events.
getDayTask() : array<string|int, mixed>
  Get non-repeating single-day event.
getEvent() : array<string|int, mixed>
  Build a single calendar event structure.
getFilePath() : string
  Get the public URL for a stored file.
getFilePathforDownload() : string
  Get file contents for download optionally from a specific disk.
getMonthlyTasks() : array<string|int, mixed>
  Generate monthly repeating events.
getRequestIP() : string
  Retrieve the client IP address considering proxies.
getWeeklyTasks() : array<string|int, mixed>
  Generate weekly repeating events.
getYearlyTasks() : array<string|int, mixed>
  Generate yearly repeating events.
index() : View
  Display the event calendar page.
is_admin() : bool
  Determine if a user ID belongs to an admin role (usergroup_id == 3).
list() : array<string|int, mixed>
  Fetch standard list and academic year range for event filters.
putContents() : string
  Save plain contents to storage with public visibility.
putContentsByFilename() : string
  Save a file with a specific filename to storage.
romanToInteger() : int|null
  Convert a Roman numeral string to an integer.
sendNotification() : DownstreamResponse|null
  Send a push notification to a user via FCM.
sendTeacherNotification() : DownstreamResponse|null
  Send a teacher-specific push notification via FCM.
sendToAssignmentReminder() : void
  Send assignment reminder to a user two days before due date.
sendToAttendanceReminder() : void
  Send absentee notifications to parents across available channels.
sendToBirthdayReminder() : void
  Send birthday or work anniversary reminders to a user via multiple channels.
sendToReminderEvent() : void
  Dispatch reminder events for an event across notification, SMS, and mail channels.
sendToSnoozeTask() : void
  Send snooze reminder for a task through notifications.
sendToSnoozeTaskWeb() : void
  Send web notification for snoozed tasks.
sendToTaskReminder() : void
  Dispatch task reminder to a user over notification, SMS, and email.
show() : View
  Display event detail page.
showdetails() : AnonymousResourceCollection
  Show event details as API resource.
showimage() : AnonymousResourceCollection
  Show event gallery images.
store() : array<string|int, mixed>|null
  Store a newly created event.
unlinkFilePath() : bool
  Delete a file from the S3 disk.
update() : array<string|int, mixed>|null
  Update an existing event.
uploadFile() : string
  Upload a file to storage and return its path.
userNotifyGroup() : void
  Notify users when added to a chat room via SMS and mail.
validateedit() : mixed

### Methods

#### adminBirthdayReminder()

EventProcess.php : 141

Notify admins about a user's birthday via all channels.

`public adminBirthdayReminder(int $school_id, string $user_name, string $user_email, int $entity_id, string $date_of_birth, string|null $mobile_no, string|null $mail, string $birth_date) : void`

##### Parameters

$school_id : int

  School identifier

$user_name : string

  Name of the user

$user_email : string

  Email of the user

$entity_id : int

  User identifier

$date_of_birth : string

  Birth date of the user

$mobile_no : string|null

  Mobile number for SMS

$mail : string|null

  Email address for mail delivery

$birth_date : string

  Date used to schedule the notification

#### changeevent()

EventsController.php : 461

Update event dates via calendar drag/drop.

`public changeevent(Request $request, int $id) : void`

##### Parameters

$request : Request
$id : int

#### createReminder()

ReminderProcess.php : 34

Create a reminder entry for later dispatch.

`public createReminder(int $school_id, string $from, string $to, string $subject, string $message, int $entity_id, string $entity_name, string $via, mixed $data, string $executed_at) : void`

##### Parameters

$school_id : int

  School identifier

$from : string

  Sender address

$to : string

  Recipient address

$subject : string

  Reminder subject

$message : string

  Reminder body

$entity_id : int

  Related entity identifier

$entity_name : string

  Related entity model name

$via : string

  Delivery channel (notification, sms, mail)

$data : mixed

  Additional payload to store with reminder

$executed_at : string

  Scheduled execution datetime

#### destroy()

EventsController.php : 481

Delete an event.

`public destroy(int $id) : RedirectResponse|null`

##### Parameters

$id : int

##### Return values

RedirectResponse|null

#### details()

EventsController.php : 837

Fetch event details for modal display with permission check.

`public details(int $id) : array<string|int, mixed>`

##### Parameters

$id : int

##### Return values

array<string|int, mixed>

#### doActivityLog()

LogActivity.php : 15

Fetches the activities of the logged in users.

`public doActivityLog(string $performed_on, string $caused_by, text $properties, mixed $logname, text $message) : mixed`

##### Parameters

$performed_on : string
$caused_by : string
$properties : text
$logname : mixed
$message : text

#### edit()

EventsController.php : 269

Fetch event data for editing.

`public edit(int $id) : AnonymousResourceCollection`

##### Parameters

$id : int

##### Return values

AnonymousResourceCollection

#### eventapprove()

EventsController.php : 403

Approve an event and trigger notifications.

`public eventapprove(int $id) : RedirectResponse`

##### Parameters

$id : int

##### Return values

RedirectResponse

#### eventImagePath()

Common.php : 118

Resolve default event image path by category.

`public eventImagePath(string $category, string $image) : string|null`

##### Parameters

$category : string

  Event category slug

$image : string

  Unused parameter kept for compatibility

##### Return values

string|null —

Public URL for the event image or null on failure

#### events()

EventsController.php : 513

Fetch all events including repeated occurrences.

`public events() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### fileUpload()

Common.php : 71

Write raw file contents to storage.

`public fileUpload(string $folder, string $file) : string`

##### Parameters

$folder : string

  Target path (including filename)

$file : string

  Raw file contents

##### Return values

string —

Storage path of the written file

#### getDailyTasks()

EventsController.php : 631

Generate daily repeating events.

`public getDailyTasks(Events $event) : array<string|int, mixed>`

##### Parameters

$event : Events

##### Return values

array<string|int, mixed>

#### getDayTask()

EventsController.php : 616

Get non-repeating single-day event.

`public getDayTask(Events $event) : array<string|int, mixed>`

##### Parameters

$event : Events

##### Return values

array<string|int, mixed>

#### getEvent()

EventsController.php : 580

Build a single calendar event structure.

`public getEvent(Events $event, Carbon $start, Carbon $end) : array<string|int, mixed>`

##### Parameters

$event : Events
$start : Carbon
$end : Carbon

##### Return values

array<string|int, mixed>

#### getFilePath()

Common.php : 24

Get the public URL for a stored file.

`public getFilePath(string $file) : string`

##### Parameters

$file : string

  Storage path

##### Return values

string —

Publicly accessible URL or empty string on failure

#### getFilePathforDownload()

Common.php : 253

Get file contents for download optionally from a specific disk.

`public getFilePathforDownload([string $disk = '' ], string $file) : string`

##### Parameters

$disk : string = ''

  Storage disk name

$file : string

  File path

##### Return values

string —

File contents

#### getMonthlyTasks()

EventsController.php : 684

Generate monthly repeating events.

`public getMonthlyTasks(Events $event) : array<string|int, mixed>`

##### Parameters

$event : Events

##### Return values

array<string|int, mixed>

#### getRequestIP()

Common.php : 93

Retrieve the client IP address considering proxies.

`public getRequestIP() : string`

##### Return values

string —

IP address

#### getWeeklyTasks()

EventsController.php : 657

Generate weekly repeating events.

`public getWeeklyTasks(Events $event) : array<string|int, mixed>`

##### Parameters

$event : Events

##### Return values

array<string|int, mixed>

#### getYearlyTasks()

EventsController.php : 711

Generate yearly repeating events.

`public getYearlyTasks(Events $event) : array<string|int, mixed>`

##### Parameters

$event : Events

##### Return values

array<string|int, mixed>

#### index()

EventsController.php : 64

Display the event calendar page.

`public index(Request $request) : View`

##### Parameters

$request : Request

##### Return values

View

#### is_admin()

Common.php : 304

Determine if a user ID belongs to an admin role (usergroup_id == 3).

`public static is_admin(int|string $userid) : bool`

##### Parameters

$userid : int|string

  User identifier

##### Return values

bool —

True if user is admin, false otherwise

#### list()

EventsController.php : 113

Fetch standard list and academic year range for event filters.

`public list() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### putContents()

Common.php : 157

Save plain contents to storage with public visibility.

`public putContents(string $folder, string $contents) : string`

##### Parameters

$folder : string

  Destination path

$contents : string

  File contents

##### Return values

string —

Storage path of the saved file

#### putContentsByFilename()

Common.php : 182

Save a file with a specific filename to storage.

`public putContentsByFilename(string $folder, UploadedFile $contents, string $filename) : string`

##### Parameters

$folder : string

  Destination folder

$contents : UploadedFile

  File instance

$filename : string

  Target filename

##### Return values

string —

Storage path of the saved file

#### romanToInteger()

Common.php : 205

Convert a Roman numeral string to an integer.

`public romanToInteger(string $roman) : int|null`

##### Parameters

$roman : string

  Roman numeral value

##### Return values

int|null —

Converted integer or null on failure

#### sendNotification()

SendPushNotification.php : 22

Send a push notification to a user via FCM.

`public sendNotification(array<string|int, mixed> $array, array<string|int, mixed>|string $usertoken) : DownstreamResponse|null`

##### Parameters

$array : array<string|int, mixed>

  Payload containing at least 'type' and 'message'

$usertoken : array<string|int, mixed>|string

  Single token or array of device tokens

##### Return values

DownstreamResponse|null —

Response object or null on failure

#### sendTeacherNotification()

SendPushNotification.php : 69

Send a teacher-specific push notification via FCM.

`public sendTeacherNotification(array<string|int, mixed> $array, array<string|int, mixed>|string $usertoken) : DownstreamResponse|null`

##### Parameters

$array : array<string|int, mixed>

  Payload containing at least 'type' and 'message'

$usertoken : array<string|int, mixed>|string

  Single token or array of device tokens

##### Return values

DownstreamResponse|null —

Response object or null on failure

#### sendToAssignmentReminder()

EventProcess.php : 272

Send assignment reminder to a user two days before due date.

`public sendToAssignmentReminder(int $school_id, string $date, string $subject_name, string $title, int $entity_id, string|null $mail, string|null $mobile_no) : void`

##### Parameters

$school_id : int

  School identifier

$date : string

  Assignment due date

$subject_name : string

  Name of the subject

$title : string

  Assignment title

$entity_id : int

  User identifier

$mail : string|null

  Email address for mail delivery

$mobile_no : string|null

  Mobile number for SMS

#### sendToAttendanceReminder()

EventProcess.php : 180

Send absentee notifications to parents across available channels.

`public sendToAttendanceReminder(int $school_id, string $date, int $entity_id, string|null $mobile_no, string|null $email, string $student_name) : void`

##### Parameters

$school_id : int

  School identifier

$date : string

  Date of absence

$entity_id : int

  Student identifier

$mobile_no : string|null

  Mobile number for SMS

$email : string|null

  Email address for mail delivery

$student_name : string

  Name of the absent student

#### sendToBirthdayReminder()

EventProcess.php : 94

Send birthday or work anniversary reminders to a user via multiple channels.

`public sendToBirthdayReminder(int $school_id, int $entity_id, string $date_of_birth, array<string|int, mixed> $data, string|null $mobile_no, string|null $mail, string $type) : void`

##### Parameters

$school_id : int

  School identifier

$entity_id : int

  User identifier

$date_of_birth : string

  Birth date for the user

$data : array<string|int, mixed>

  Payload passed to the reminder event

$mobile_no : string|null

  Mobile number for SMS

$mail : string|null

  Email address for mail delivery

$type : string

  Reminder type ('birthday' or 'work_anniversary')

#### sendToReminderEvent()

EventProcess.php : 25

Dispatch reminder events for an event across notification, SMS, and mail channels.

`public sendToReminderEvent(Events $events, string $executed_at, string $check) : void`

##### Parameters

$events : Events

  Event instance containing schedule info

$executed_at : string

  Date string used to schedule the reminder (Y-m-d)

$check : string

  Indicator for recurrence handling (e.g., 'next')

#### sendToSnoozeTask()

EventProcess.php : 303

Send snooze reminder for a task through notifications.

`public sendToSnoozeTask(int $school_id, string $date, string $title, int $entity_id, string|null $mail, string|null $mobile_no) : void`

##### Parameters

$school_id : int

  School identifier

$date : string

  Rescheduled reminder date

$title : string

  Task title

$entity_id : int

  Task identifier

$mail : string|null

  Email address for mail delivery

$mobile_no : string|null

  Mobile number for SMS

#### sendToSnoozeTaskWeb()

EventProcess.php : 333

Send web notification for snoozed tasks.

`public sendToSnoozeTaskWeb(int $school_id, string $date, string $title, int $entity_id, string|null $mail, string|null $mobile_no) : void`

##### Parameters

$school_id : int

  School identifier

$date : string

  Rescheduled reminder date

$title : string

  Task title

$entity_id : int

  Task identifier

$mail : string|null

  Email address for mail delivery

$mobile_no : string|null

  Mobile number for SMS

#### sendToTaskReminder()

EventProcess.php : 236

Dispatch task reminder to a user over notification, SMS, and email.

`public sendToTaskReminder(int $school_id, string $date, string $title, int $entity_id, string|null $mail, string|null $mobile_no) : void`

##### Parameters

$school_id : int

  School identifier

$date : string

  Date to execute reminder

$title : string

  Task title

$entity_id : int

  Task identifier

$mail : string|null

  Email address for mail delivery

$mobile_no : string|null

  Mobile number for SMS

#### show()

EventsController.php : 737

Display event detail page.

`public show(int $id) : View`

##### Parameters

$id : int

##### Return values

View

#### showdetails()

EventsController.php : 812

Show event details as API resource.

`public showdetails(int $id) : AnonymousResourceCollection`

##### Parameters

$id : int

##### Return values

AnonymousResourceCollection

#### showimage()

EventsController.php : 824

Show event gallery images.

`public showimage(int $event_id) : AnonymousResourceCollection`

##### Parameters

$event_id : int

##### Return values

AnonymousResourceCollection

#### store()

EventsController.php : 139

Store a newly created event.

`public store(EventRequest $request) : array<string|int, mixed>|null`

##### Parameters

$request : EventRequest

##### Return values

array<string|int, mixed>|null

#### unlinkFilePath()

Common.php : 282

Delete a file from the S3 disk.

`public unlinkFilePath(string $file) : bool`

##### Parameters

$file : string

  File path on S3

##### Return values

bool —

True after attempting deletion

#### update()

EventsController.php : 289

Update an existing event.

`public update(Request $request, int $id) : array<string|int, mixed>|null`

##### Parameters

$request : Request
$id : int

##### Return values

array<string|int, mixed>|null

#### uploadFile()

Common.php : 47

Upload a file to storage and return its path.

`public uploadFile(string $folder, UploadedFile $file) : string`

##### Parameters

$folder : string

  Target folder path

$file : UploadedFile

  File to upload

##### Return values

string —

Storage path for the uploaded file

#### userNotifyGroup()

EventProcess.php : 362

Notify users when added to a chat room via SMS and mail.

`public userNotifyGroup(int $school_id, int $entity_id, string|null $mobile_no, string|null $email, string $date) : void`

##### Parameters

$school_id : int

  School identifier

$entity_id : int

  Room link identifier

$mobile_no : string|null

  Mobile number for SMS

$email : string|null

  Email address for mail delivery

$date : string

  Notification execution date

#### validateedit()

EventsController.php : 277
`public validateedit(EventUpdateRequest $request) : mixed`

##### Parameters

$request : EventUpdateRequest

## Search results