Menu

## PostalRecord extends Model
in package
uses Common

PostalRecord.php : 34

Class PostalRecord

Model for managing postal records and correspondence.

##### Tags

mixin

### Table of Contents

#### Properties

$academic_year_id : int
$attachment_path : string
$confidential : int
$created_at : DateTime
$description : string
$entry_by : int
$id : int
$postal_date : DateTime
$receiver_address : string
$receiver_title : string
$reference_number : string
$school_id : int
$sender_address : string
$sender_title : string
$type : string
$updated_at : DateTime
$fillable : mixed
$table : mixed

#### Methods

eventImagePath() : string|null
  Resolve default event image path by category.
fileUpload() : string
  Write raw file contents to storage.
getAttachmentPathAttribute() : string
  Get the full file path for the postal record attachment.
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.
unlinkFilePath() : bool
  Delete a file from the S3 disk.
uploadFile() : string
  Upload a file to storage and return its path.

### Properties

#### $academic_year_id

PostalRecord.php : 0
`public int $academic_year_id`

#### $attachment_path

PostalRecord.php : 0
`public string $attachment_path`

#### $confidential

PostalRecord.php : 0
`public int $confidential`

#### $created_at

PostalRecord.php : 0
`public DateTime $created_at`

#### $description

PostalRecord.php : 0
`public string $description`

#### $entry_by

PostalRecord.php : 0
`public int $entry_by`

#### $id

PostalRecord.php : 0
`public int $id`

#### $postal_date

PostalRecord.php : 0
`public DateTime $postal_date`

#### $receiver_address

PostalRecord.php : 0
`public string $receiver_address`

#### $receiver_title

PostalRecord.php : 0
`public string $receiver_title`

#### $reference_number

PostalRecord.php : 0
`public string $reference_number`

#### $school_id

PostalRecord.php : 0
`public int $school_id`

#### $sender_address

PostalRecord.php : 0
`public string $sender_address`

#### $sender_title

PostalRecord.php : 0
`public string $sender_title`

#### $type

PostalRecord.php : 0
`public string $type`

#### $updated_at

PostalRecord.php : 0
`public DateTime $updated_at`

#### $fillable

PostalRecord.php : 40
`protected mixed $fillable = ['school_id', 'academic_year_id', 'type', 'reference_number', 'confidential', 'sender_title', 'sender_address', 'receiver_title', 'receiver_address', 'postal_date', 'description', 'entry_by']`

#### $table

PostalRecord.php : 38
`protected mixed $table = 'postal_record'`

### Methods

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

#### getAttachmentPathAttribute()

PostalRecord.php : 49

Get the full file path for the postal record attachment.

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

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

## Search results