AuthorController
extends BaseController
in package
Author Controller
This controller manages comprehensive author operations including author CRUD, search functionality, and author information management. It provides functionality for managing author data with sorting and pagination capabilities for content management system authors.
Table of Contents
Methods
- __construct() : void
- Create a new AuthorController instance.
- create() : View
- Show the form for creating a new author.
- destroy() : RedirectResponse
- Remove the specified author from storage.
- edit() : View
- Show the form for editing the specified author.
- index() : View
- Display a listing of authors with search and pagination functionality.
- store() : RedirectResponse
- Store a newly created author in storage.
- update() : RedirectResponse
- Update the specified author in storage.
Methods
__construct()
Create a new AuthorController instance.
public
__construct() : void
Checks if user is logged in and has proper permissions for author management. Redirects to appropriate page if permissions are not met.
create()
Show the form for creating a new author.
public
create(Request $request) : View
Displays the author creation form for adding new authors to the content management system.
Parameters
- $request : Request
Return values
Viewdestroy()
Remove the specified author from storage.
public
destroy(int $id) : RedirectResponse
Deletes author record and provides confirmation message. Handles author removal with proper error handling.
Parameters
- $id : int
Return values
RedirectResponseedit()
Show the form for editing the specified author.
public
edit(int $id, Request $request) : View
Displays the author edit form with security key validation. Requires valid security key to prevent unauthorized access. Supports author information updates with proper validation.
Parameters
- $id : int
- $request : Request
Return values
Viewindex()
Display a listing of authors with search and pagination functionality.
public
index(Request $request) : View
Provides a paginated list of authors with search capabilities. Supports author name search with case-insensitive matching. Includes sorting functionality for better data organization.
Parameters
- $request : Request
Return values
Viewstore()
Store a newly created author in storage.
public
store(Request $request) : RedirectResponse
Validates author input, creates new author record, and tracks creation activity. Supports author name validation and user tracking for audit purposes.
Parameters
- $request : Request
Return values
RedirectResponseupdate()
Update the specified author in storage.
public
update(Request $request, int $id) : RedirectResponse
Handles author updates including name changes and user tracking. Validates author input and tracks update activity for audit purposes. Supports comprehensive author information management.
Parameters
- $request : Request
- $id : int