Section
extends Model
in package
uses
Sortable, HasFactory
Section Model
This model manages content sections and components for the CICMS system. It stores section information, content, media, buttons, and configuration for modular content blocks and page sections.
Table of Contents
Properties
- $fillable : array<string|int, string>
- The attributes that are mass assignable.
Methods
- __construct() : void
- Create a new Section model instance.
- getSection() : Collection
- Get sections for search text with pagination.
- getTotalCount() : int
- Get total count of sections for search text.
- sortById() : array<string|int, mixed>
- Get sections based on sort order by ID.
Properties
$fillable
The attributes that are mass assignable.
protected
array<string|int, string>
$fillable
= ['sec_title', 'sec_desc', 'sec_pic', 'photo_path', 'sub_title', 'button_text', 'button_link', 'icon_desc', 'sec_type', 'plain_html_desc', 'created_by', 'updated_by', 'created_at', 'updated_at']
Methods
__construct()
Create a new Section model instance.
public
__construct() : void
Sets the table name from configuration constants.
getSection()
Get sections for search text with pagination.
public
getSection(string $searchText, int $pageOffset) : Collection
This function used to get results for search text.
Parameters
- $searchText : string
-
The search text to filter sections
- $pageOffset : int
-
Pagination offset
Return values
Collection —Collection of matching sections
getTotalCount()
Get total count of sections for search text.
public
getTotalCount(string $searchText) : int
This function used to get results and check total count.
Parameters
- $searchText : string
-
The search text to filter sections
Return values
int —Total count of matching sections
sortById()
Get sections based on sort order by ID.
public
static sortById(string $id) : array<string|int, mixed>
This function used to get results based on the sortby.
Parameters
- $id : string
-
Comma-separated list of section IDs
Return values
array<string|int, mixed> —Array of section objects in the specified order