Menu

## Events extends Model
in package
uses SoftDeletes, Common

Events.php : 51

Class Events

Model for managing school events and activities.

##### Tags

mixin

### Table of Contents

#### Properties

$academic_year_id : int
$academicYear : AcademicYear
$allDay : int
$category : string
$created_at : DateTime
$created_by : int
$createdBy : User
$deleted_at : DateTime
$description : string
$end_date : DateTime
$eventgallery : Collection|array<string|int, EventGallery>
$eventreminder : Collection|array<string|int, Reminder>
$freq : string
$freq_term : string
$id : int
$image : string
$image_path : string
$location : string
$notes : Collection|array<string|int, Notes>
$organised_by : string
$repeats : string
$school : School
$school_id : int
$select_type : string
$standard_id : int
$standardlink : StandardLink
$start_date : DateTime
$status : int
$title : string
$updated_at : DateTime
$updated_by : int
$updatedBy : User
$url : string
$casts : array<string|int, mixed>
  The attributes that should be mutated to dates.
$fillable : array<string|int, mixed>
  The attributes that are mass assignable.
$table : mixed

#### Methods

academicYear() : BelongsTo
  Get the academic year for this event.
createdBy() : BelongsTo
  Get the user who created this event.
eventgallery() : HasMany
  Get event gallery images.
eventImagePath() : string|null
  Resolve default event image path by category.
eventreminder() : HasMany
  Get event reminders.
fileUpload() : string
  Write raw file contents to storage.
getFilePath() : string
  Get the public URL for a stored file.
getFilePathforDownload() : string
  Get file contents for download optionally from a specific disk.
getImagePathAttribute() : string|null
  Get the image path for this event.
getphotocount() : int
  Get count of photos in this event gallery.
getRequestIP() : string
  Retrieve the client IP address considering proxies.
is_admin() : bool
  Determine if a user ID belongs to an admin role (usergroup_id == 3).
notes() : HasMany
  Get notes related to this event.
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.
school() : BelongsTo
  Get the school for this event.
scopeByChurch() : Builder
  Scope to filter events by church.
scopeByDate() : Builder
  Scope to filter events by date range.
standardlink() : BelongsTo
  Get the standard link for this event.
unlinkFilePath() : bool
  Delete a file from the S3 disk.
updatedBy() : BelongsTo
  Get the user who last updated this event.
uploadFile() : string
  Upload a file to storage and return its path.

### Properties

#### $academic_year_id

Events.php : 0
`public int $academic_year_id`

#### $academicYear read-only

Events.php : 0
`public AcademicYear $academicYear`

#### $allDay

Events.php : 0
`public int $allDay`

#### $category

Events.php : 0
`public string $category`

#### $created_at

Events.php : 0
`public DateTime $created_at`

#### $created_by

Events.php : 0
`public int $created_by`

#### $createdBy read-only

Events.php : 0
`public User $createdBy`

#### $deleted_at

Events.php : 0
`public DateTime $deleted_at`

#### $description

Events.php : 0
`public string $description`

#### $end_date

Events.php : 0
`public DateTime $end_date`

#### $eventgallery read-only

Events.php : 0
`public Collection|array<string|int, EventGallery> $eventgallery`

#### $eventreminder read-only

Events.php : 0
`public Collection|array<string|int, Reminder> $eventreminder`

#### $freq

Events.php : 0
`public string $freq`

#### $freq_term

Events.php : 0
`public string $freq_term`

#### $id

Events.php : 0
`public int $id`

#### $image

Events.php : 0
`public string $image`

#### $image_path

Events.php : 0
`public string $image_path`

#### $location

Events.php : 0
`public string $location`

#### $notes read-only

Events.php : 0
`public Collection|array<string|int, Notes> $notes`

#### $organised_by

Events.php : 0
`public string $organised_by`

#### $repeats

Events.php : 0
`public string $repeats`

#### $school read-only

Events.php : 0
`public School $school`

#### $school_id

Events.php : 0
`public int $school_id`

#### $select_type

Events.php : 0
`public string $select_type`

#### $standard_id

Events.php : 0
`public int $standard_id`

#### $standardlink read-only

Events.php : 0
`public StandardLink $standardlink`

#### $start_date

Events.php : 0
`public DateTime $start_date`

#### $status

Events.php : 0
`public int $status`

#### $title

Events.php : 0
`public string $title`

#### $updated_at

Events.php : 0
`public DateTime $updated_at`

#### $updated_by

Events.php : 0
`public int $updated_by`

#### $updatedBy read-only

Events.php : 0
`public User $updatedBy`

#### $url

Events.php : 0
`public string $url`

#### $casts

Events.php : 74

The attributes that should be mutated to dates.

`protected array<string|int, mixed> $casts = ['start_date' => 'datetime', 'end_date' => 'datetime', 'deleted_at' => 'datetime']`

#### $fillable

Events.php : 63

The attributes that are mass assignable.

`protected array<string|int, mixed> $fillable = ['school_id', 'academic_year_id', 'standard_id', 'select_type', 'title', 'description', 'repeats', 'freq', 'freq_term', 'location', 'category', 'organised_by', 'image', 'start_date', 'end_date', 'allDay', 'url', 'created_by', 'updated_by', 'status']`

#### $table

Events.php : 56
`protected mixed $table = 'events'`

### Methods

#### academicYear()

Events.php : 95

Get the academic year for this event.

`public academicYear() : BelongsTo`

##### Return values

BelongsTo

#### createdBy()

Events.php : 115

Get the user who created this event.

`public createdBy() : BelongsTo`

##### Return values

BelongsTo

#### eventgallery()

Events.php : 168

Get event gallery images.

`public eventgallery() : HasMany`

##### Return values

HasMany

#### 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

#### eventreminder()

Events.php : 158

Get event reminders.

`public eventreminder() : HasMany`

##### Return values

HasMany

#### 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

#### 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

#### getImagePathAttribute()

Events.php : 178

Get the image path for this event.

`public getImagePathAttribute() : string|null`

##### Return values

string|null

#### getphotocount()

Events.php : 193

Get count of photos in this event gallery.

`public getphotocount(int $id, int $school_id) : int`

##### Parameters

$id : int
$school_id : int

##### Return values

int

#### getRequestIP()

Common.php : 93

Retrieve the client IP address considering proxies.

`public getRequestIP() : string`

##### Return values

string —

IP address

#### 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

#### notes()

Events.php : 135

Get notes related to this event.

`public notes() : HasMany`

##### Return values

HasMany

#### 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

#### school()

Events.php : 85

Get the school for this event.

`public school() : BelongsTo`

##### Return values

BelongsTo

#### scopeByChurch()

Events.php : 147

Scope to filter events by church.

`public scopeByChurch(Builder $query, int $church_id) : Builder`

##### Parameters

$query : Builder
$church_id : int

##### Return values

Builder

#### scopeByDate()

Events.php : 208

Scope to filter events by date range.

`public scopeByDate(Builder $query, DateTime $start_date, DateTime $end_date) : Builder`

##### Parameters

$query : Builder
$start_date : DateTime
$end_date : DateTime

##### Return values

Builder

#### standardlink()

Events.php : 105

Get the standard link for this event.

`public standardlink() : BelongsTo`

##### Return values

BelongsTo

#### 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

#### updatedBy()

Events.php : 125

Get the user who last updated this event.

`public updatedBy() : BelongsTo`

##### Return values

BelongsTo

#### 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

## Search results