Skip to main content
The Besc_crud class provides functionality for creating, reading, updating and deleting database records, as well as rendering views for listing and editing data.

Properties

object
CodeIgniter instance
string
Database name
string
Database table name
string
Primary key column name
array
Array of column definitions
array
Array of column names to show in list view
array
Array of column names to allow filtering on
string
Title for the CRUD views
string
Base URL for CRUD operations

Methods

__construct()

Constructor method. Initializes CodeIgniter dependencies.

execute($per_page = ROWS_PER_PAGE_OF_TABLE)

Main method to handle CRUD operations based on the current state.
integer
Number of rows per page for list view

render_list($ajax = false)

Renders the list view.
boolean
Whether this is an AJAX request

render_edit()

Renders the edit view for adding or editing a record.

delete()

Deletes a record.

insert()

Inserts a new record.

update()

Updates an existing record.

validate()

Validates submitted form data.

imageupload()

Handles image file uploads.

fileupload()

Handles general file uploads.

imagecrop()

Crops an uploaded image.

Usage

This initializes a CRUD interface for the “users” table. The execute() method handles the current operation (list, add, edit, etc) and returns the appropriate view.