GalleryController
extends BaseController
in package
Gallery Controller
This controller manages comprehensive gallery operations including gallery CRUD, photo management, image uploads, and gallery administration. It provides functionality for managing galleries with advanced filtering, photo organization, and gallery administration for the CMS system.
Table of Contents
Methods
- __construct() : void
- Create a new GalleryController instance.
- changeImageDesc() : bool
- Change the description/alt tag of a gallery photo.
- changeImageTitle() : bool
- Change the title of a gallery photo.
- create() : View
- Show the form for creating a new gallery.
- createUrlSlug() : string
- Create a URL-friendly slug from a string.
- deleteImage() : void
- Delete a gallery photo from storage.
- destroy() : RedirectResponse
- Remove the specified gallery from storage.
- edit() : View
- Show the form for editing the specified gallery.
- index() : View
- Display a listing of galleries with filtering and search capabilities.
- managePhoto() : View
- Manage photos of a specific gallery.
- sorting() : void
- Sort gallery photos based on drag and drop order.
- store() : RedirectResponse
- Store a newly created gallery in storage.
- update() : RedirectResponse
- Update the specified gallery in storage.
- UploadImageToServer() : void
- Upload a new image to the gallery and create a thumbnail.
Methods
__construct()
Create a new GalleryController instance.
public
__construct() : void
Checks if user is logged in and has proper permissions for gallery management. Redirects to appropriate page if permissions are not met.
changeImageDesc()
Change the description/alt tag of a gallery photo.
public
changeImageDesc(Request $request, int $id) : bool
Updates the alt tag/description of a specific gallery photo in the database. Returns boolean indicating success or failure of the update operation.
Parameters
- $request : Request
- $id : int
Return values
boolchangeImageTitle()
Change the title of a gallery photo.
public
changeImageTitle(Request $request, int $id) : bool
Updates the title of a specific gallery photo in the database. Returns boolean indicating success or failure of the update operation.
Parameters
- $request : Request
- $id : int
Return values
boolcreate()
Show the form for creating a new gallery.
public
create(Request $request) : View
Displays the gallery creation form with support for different gallery types. Initializes a new gallery instance for form population.
Parameters
- $request : Request
Return values
ViewcreateUrlSlug()
Create a URL-friendly slug from a string.
public
createUrlSlug(string $urlString) : string
Converts a string to a URL-friendly slug by replacing non-alphanumeric characters with hyphens and removing extra hyphens.
Parameters
- $urlString : string
Return values
stringdeleteImage()
Delete a gallery photo from storage.
public
deleteImage(Request $request, int $id) : void
Removes the photo file and thumbnail from the filesystem and deletes the database record. Handles different form types and provides feedback.
Parameters
- $request : Request
- $id : int
destroy()
Remove the specified gallery from storage.
public
destroy(int $id, Request $request) : RedirectResponse
Deletes the gallery record and logs the activity for audit purposes. Handles different gallery types and provides appropriate feedback messages.
Parameters
- $id : int
- $request : Request
Return values
RedirectResponseedit()
Show the form for editing the specified gallery.
public
edit(Request $request, int $id) : View
Validates user permissions and gallery ID before displaying the edit form. Includes security checks with MD5 hash validation for gallery access.
Parameters
- $request : Request
- $id : int
Return values
Viewindex()
Display a listing of galleries with filtering and search capabilities.
public
index(Request $request) : View
Provides a paginated list of galleries with support for different gallery types. Includes search functionality and type-based filtering for gallery management. Supports comprehensive gallery listing with sortable columns and search.
Parameters
- $request : Request
Return values
ViewmanagePhoto()
Manage photos of a specific gallery.
public
managePhoto(Request $request[, int|null $galleryId = null ]) : View
Displays the photo management interface for a specific gallery. Loads gallery information and associated photos for editing and organization.
Parameters
- $request : Request
- $galleryId : int|null = null
Return values
Viewsorting()
Sort gallery photos based on drag and drop order.
public
sorting(Request $request) : void
Updates the sort order of gallery photos based on user drag-and-drop actions. Returns a JSON-encoded status response for AJAX requests.
Parameters
- $request : Request
store()
Store a newly created gallery in storage.
public
store(Request $request) : RedirectResponse
Validates gallery data, creates a new gallery record, and logs the activity. Generates URL slug automatically from gallery name and handles different gallery types.
Parameters
- $request : Request
Return values
RedirectResponseupdate()
Update the specified gallery in storage.
public
update(Request $request, int $id) : RedirectResponse
Validates gallery data, updates the gallery record, and logs the activity. Handles gallery status, sorting, and alias generation for different gallery types.
Parameters
- $request : Request
- $id : int
Return values
RedirectResponseUploadImageToServer()
Upload a new image to the gallery and create a thumbnail.
public
UploadImageToServer(Request $request) : void
Handles file upload, validates file type, saves the image and thumbnail, and inserts the image record in the database. Returns HTML for the uploaded image block for gallery display with editing capabilities.
Parameters
- $request : Request