Menu

## Bulletin extends Model
in package
uses SoftDeletes, Common

Bulletin.php : 32

Class Bulletin

Model for managing school bulletins and magazines.

##### Tags

mixin

### Table of Contents

#### Properties

$academic_year_id : int
$academicYear : AcademicYear
$bulletin_file : string
$cover_image : string
$created_at : DateTime
$deleted_at : DateTime
$file_path : string
$id : int
$image_path : string
$name : string
$school : School
$school_id : int
$updated_at : DateTime
$year : int
$fillable : array<string|int, mixed>
  The attributes that are mass assignable.
$table : mixed

#### Methods

academicYear() : BelongsTo
  Get the academic year for this bulletin.
eventImagePath() : string|null
  Resolve default event image path by category.
fileUpload() : string
  Write raw file contents to storage.
getFilePath() : string
  Get the public URL for a stored file.
getFilePathAttribute() : string
  Get the full file path for the bulletin document.
getFilePathforDownload() : string
  Get file contents for download optionally from a specific disk.
getImagePathAttribute() : string
  Get the full file path for the bulletin cover image.
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 bulletin.
unlinkFilePath() : bool
  Delete a file from the S3 disk.
uploadFile() : string
  Upload a file to storage and return its path.

### Properties

#### $academic_year_id

Bulletin.php : 0
`public int $academic_year_id`

#### $academicYear read-only

Bulletin.php : 0
`public AcademicYear $academicYear`

#### $bulletin_file

Bulletin.php : 0
`public string $bulletin_file`

#### $cover_image

Bulletin.php : 0
`public string $cover_image`

#### $created_at

Bulletin.php : 0
`public DateTime $created_at`

#### $deleted_at

Bulletin.php : 0
`public DateTime $deleted_at`

#### $file_path

Bulletin.php : 0
`public string $file_path`

#### $id

Bulletin.php : 0
`public int $id`

#### $image_path

Bulletin.php : 0
`public string $image_path`

#### $name

Bulletin.php : 0
`public string $name`

#### $school read-only

Bulletin.php : 0
`public School $school`

#### $school_id

Bulletin.php : 0
`public int $school_id`

#### $updated_at

Bulletin.php : 0
`public DateTime $updated_at`

#### $year

Bulletin.php : 0
`public int $year`

#### $fillable

Bulletin.php : 43

The attributes that are mass assignable.

`protected array<string|int, mixed> $fillable = ['school_id', 'academic_year_id', 'name', 'year', 'bulletin_file']`

#### $table

Bulletin.php : 36
`protected mixed $table = 'magazines'`

### Methods

#### academicYear()

Bulletin.php : 62

Get the academic year for this bulletin.

`public academicYear() : BelongsTo`

##### Return values

BelongsTo

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

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

#### getFilePathAttribute()

Bulletin.php : 72

Get the full file path for the bulletin document.

`public getFilePathAttribute() : string`

##### Return values

string

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

Bulletin.php : 82

Get the full file path for the bulletin cover image.

`public getImagePathAttribute() : string`

##### Return values

string

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

Bulletin.php : 52

Get the school for this bulletin.

`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

## Search results