ModuleController
extends BaseController
in package
Module Controller
This controller manages comprehensive module operations including module CRUD, search functionality, and module organization. It provides functionality for managing system modules with display order management, module descriptions, and module file associations for the security system.
Table of Contents
Methods
- __construct() : void
- Create a new ModuleController instance.
- create() : View
- Show the form for creating a new module.
- destroy() : RedirectResponse
- Remove the specified module from storage.
- edit() : View
- Show the form for editing the specified module.
- index() : View
- Display a listing of modules with search functionality and pagination.
- store() : RedirectResponse
- Store a newly created module in storage.
- update() : RedirectResponse
- Update the specified module in storage.
Methods
__construct()
Create a new ModuleController instance.
public
__construct() : void
Checks if user is logged in and has proper permissions for module management. Redirects to appropriate page if permissions are not met.
create()
Show the form for creating a new module.
public
create(Request $request) : View
Displays the module creation form with initialized form fields. Provides interface for adding new modules to the system.
Parameters
- $request : Request
Return values
Viewdestroy()
Remove the specified module from storage.
public
destroy(int $id) : RedirectResponse
Deletes the module record and provides appropriate feedback message. Handles module deletion with proper error handling.
Parameters
- $id : int
Return values
RedirectResponseedit()
Show the form for editing the specified module.
public
edit(int $id, Request $request) : View
Validates user permissions and module ID before displaying the edit form. Includes security checks with MD5 hash validation for module access. Loads existing module data for editing.
Parameters
- $id : int
- $request : Request
Return values
Viewindex()
Display a listing of modules with search functionality and pagination.
public
index(Request $request) : View
Provides a paginated list of modules with comprehensive search capabilities. Supports filtering by module name and includes sortable columns for module management. Displays modules in descending order by ID with configurable pagination.
Parameters
- $request : Request
Return values
Viewstore()
Store a newly created module in storage.
public
store(Request $request) : RedirectResponse
Validates module data and creates a new module record. Handles module name, description, file association, and display order. Provides appropriate feedback message after successful creation.
Parameters
- $request : Request
Return values
RedirectResponseupdate()
Update the specified module in storage.
public
update(Request $request, int $id) : RedirectResponse
Validates module data and updates the module record. Handles module name, description, file association, and display order updates. Provides appropriate feedback message after successful update.
Parameters
- $request : Request
- $id : int