Menu

## ClassRoomPage extends Model
in package
uses SoftDeletes, Common

ClassRoomPage.php : 37

Class ClassRoomPage

Model for managing classroom pages and content.

##### Tags

mixin

### Table of Contents

#### Properties

$academic_year_id : int
$academicYear : AcademicYear
$category_id : int
$classRoomPageAttachment : Collection|array<string|int, ClassRoomPageAttachment>
$classRoomPageCategory : ClassRoomPageCategory
$classRoomPageDetail : Collection|array<string|int, ClassRoomPageDetail>
$cover_image : string
$cover_image_path : string
$created_at : DateTime
$created_by : int
$deleted_at : DateTime
$description : string
$id : int
$page_name : string
$school : School
$school_id : int
$status : int
$updated_at : DateTime
$user : User
$dates : 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 classroom page.
classRoomPageAttachment() : HasMany
  Get the attachments for this classroom page.
classRoomPageCategory() : BelongsTo
  Get the category for this classroom page.
classRoomPageDetail() : HasMany
  Get the details for this classroom page.
eventImagePath() : string|null
  Resolve default event image path by category.
fileUpload() : string
  Write raw file contents to storage.
getCoverImagePathAttribute() : string
  Get the full file path for the cover image.
getFilePath() : string
  Get the public URL for a stored file.
getFilePathforDownload() : string
  Get file contents for download optionally from a specific disk.
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).
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 classroom page.
unlinkFilePath() : bool
  Delete a file from the S3 disk.
uploadFile() : string
  Upload a file to storage and return its path.
user() : BelongsTo
  Get the user who created this page.

### Properties

#### $academic_year_id

ClassRoomPage.php : 0
`public int $academic_year_id`

#### $academicYear read-only

ClassRoomPage.php : 0
`public AcademicYear $academicYear`

#### $category_id

ClassRoomPage.php : 0
`public int $category_id`

#### $classRoomPageAttachment read-only

ClassRoomPage.php : 0
`public Collection|array<string|int, ClassRoomPageAttachment> $classRoomPageAttachment`

#### $classRoomPageCategory read-only

ClassRoomPage.php : 0
`public ClassRoomPageCategory $classRoomPageCategory`

#### $classRoomPageDetail read-only

ClassRoomPage.php : 0
`public Collection|array<string|int, ClassRoomPageDetail> $classRoomPageDetail`

#### $cover_image

ClassRoomPage.php : 0
`public string $cover_image`

#### $cover_image_path

ClassRoomPage.php : 0
`public string $cover_image_path`

#### $created_at

ClassRoomPage.php : 0
`public DateTime $created_at`

#### $created_by

ClassRoomPage.php : 0
`public int $created_by`

#### $deleted_at

ClassRoomPage.php : 0
`public DateTime $deleted_at`

#### $description

ClassRoomPage.php : 0
`public string $description`

#### $id

ClassRoomPage.php : 0
`public int $id`

#### $page_name

ClassRoomPage.php : 0
`public string $page_name`

#### $school read-only

ClassRoomPage.php : 0
`public School $school`

#### $school_id

ClassRoomPage.php : 0
`public int $school_id`

#### $status

ClassRoomPage.php : 0
`public int $status`

#### $updated_at

ClassRoomPage.php : 0
`public DateTime $updated_at`

#### $user read-only

ClassRoomPage.php : 0
`public User $user`

#### $dates

ClassRoomPage.php : 59

The attributes that should be mutated to dates.

`protected array<string|int, mixed> $dates = ['deleted_at']`

#### $fillable

ClassRoomPage.php : 50

The attributes that are mass assignable.

`protected array<string|int, mixed> $fillable = ['school_id', 'academic_year_id', 'page_name', 'category_id', 'description', 'cover_image', 'created_by', 'status']`

#### $table

ClassRoomPage.php : 42
`protected mixed $table = 'class_room_pages'`

### Methods

#### academicYear()

ClassRoomPage.php : 76

Get the academic year for this classroom page.

`public academicYear() : BelongsTo`

##### Return values

BelongsTo

#### classRoomPageAttachment()

ClassRoomPage.php : 106

Get the attachments for this classroom page.

`public classRoomPageAttachment() : HasMany`

##### Return values

HasMany

#### classRoomPageCategory()

ClassRoomPage.php : 116

Get the category for this classroom page.

`public classRoomPageCategory() : BelongsTo`

##### Return values

BelongsTo

#### classRoomPageDetail()

ClassRoomPage.php : 96

Get the details for this classroom page.

`public classRoomPageDetail() : 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

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

#### getCoverImagePathAttribute()

ClassRoomPage.php : 126

Get the full file path for the cover image.

`public getCoverImagePathAttribute() : string`

##### Return values

string

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

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

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

ClassRoomPage.php : 66

Get the school for this classroom page.

`public school() : 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

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

#### user()

ClassRoomPage.php : 86

Get the user who created this page.

`public user() : BelongsTo`

##### Return values

BelongsTo

## Search results