AdminDashboardController
extends Controller
in package
Admin dashboard controller.
Manages the platform admin panel including client oversight and site mode overrides.
Tags
Table of Contents
Constants
- CSV_FIELDS = ['id', 'name', 'slug', 'business_type', 'description', 'tagline', 'address_street', 'address_city', 'address_state', 'address_zip', 'phone', 'email', 'website_url', 'social_facebook', 'social_instagram', 'social_twitter', 'social_tiktok', 'accepts_cash', 'accepts_card_onsite', 'accepts_online_payment', 'tax_rate', 'currency', 'timezone', 'order_lead_time', 'default_asap_delay', 'site_status', 'subscription_tier', 'accepts_reservations', 'reservation_duration_minutes', 'reservation_buffer_minutes', 'max_party_size', 'min_party_size', 'reservation_lead_hours', 'reservation_advance_days']
Properties
- $layout : string
Methods
- adminSettings() : void
- Show the admin settings page.
- analytics() : void
- Show platform-wide analytics.
- archiveClient() : void
- Create a new archive for a client business.
- archiveDetail() : void
- View details of a specific archive.
- archives() : void
- List all client data archives.
- assignBusinessToGroup() : void
- Assign a business to a group.
- billing() : void
- Show platform billing overview.
- billingDetail() : void
- Show billing detail for a specific business.
- blockedEmails() : void
- Show blocked email addresses list.
- blockedIps() : void
- Show blocked IP addresses list.
- changePassword() : void
- Show the change password form.
- clientDetail() : void
- Show detailed view for a single client business.
- clients() : void
- Show enhanced client list with subscription and revenue data.
- clientsCsv() : void
- Show the CSV import/export page.
- createClient() : void
- Show the create client form.
- createGroup() : void
- Show the create group form.
- createInvoice() : void
- Show the manual invoice creation form.
- deleteArchive() : void
- Delete an archive.
- deleteBlockedEmail() : void
- Unblock an email address.
- deleteBlockedIp() : void
- Unblock an IP address.
- deleteClient() : void
- Delete a client business and all associated data.
- deleteGroup() : void
- Delete a business group (unassigns all businesses first).
- downloadArchive() : void
- Download an archive as a ZIP file.
- downloadCsvTemplate() : void
- Download a blank CSV template for importing client settings.
- editClient() : void
- Show the edit client form.
- editGroup() : void
- Show the edit group form.
- exportClientsCsv() : void
- Export all client store settings as a CSV download.
- extendTrial() : void
- Extend a business trial period.
- groupDetail() : void
- View a business group's details.
- groups() : void
- List all business groups.
- importClientsCsv() : void
- Import client store settings from an uploaded CSV file.
- index() : void
- Show the admin dashboard with all client businesses.
- loginAsClient() : void
- Impersonate a client (login as a business owner).
- loginAsCustomer() : void
- Impersonate a customer (admin action).
- markInvoicePaid() : void
- Mark an invoice as paid (admin override).
- modules() : void
- Show module manager page with pricing and tier assignments.
- overrideSiteMode() : void
- Override a business site mode (admin action).
- overrideSuspend() : void
- Suspend a business for non-payment (admin action).
- removeBusinessFromGroup() : void
- Remove a business from a group.
- saveAdminSettings() : void
- Save admin settings (language preference).
- savePassword() : void
- Process the password change.
- sendInvoiceEmail() : void
- Send (or re-send) an invoice email to the business owner.
- stopImpersonation() : void
- Stop the current impersonation session (admin action).
- storeBlockedEmail() : void
- Block a new email address.
- storeBlockedIp() : void
- Block a new IP address.
- storeClient() : void
- Store a new client business and owner account.
- storeGroup() : void
- Store a new business group.
- storeInvoice() : void
- Store a manually created invoice.
- toggleModule() : void
- Toggle a feature module for a business (admin override).
- updateClient() : void
- Update an existing client business and owner account.
- updateGroup() : void
- Update a business group.
- updateModulePricing() : void
- Update module pricing.
- voidInvoice() : void
- Void an invoice (admin action).
- zipcodeLookup() : void
- Look up city and state by ZIP code.
- baseUrl() : string
- Get the base URL for the application.
- buildPagination() : array<string|int, mixed>
- Build pagination metadata for views.
- clearOldInput() : void
- Clear stored old input data.
- flash() : void
- Set a flash message in the session.
- flashOldInput() : void
- Store current POST data as old input for form repopulation.
- getPage() : int
- Get the current page number from the query string.
- json() : void
- Send a JSON response.
- old() : mixed
- Get previous form input after validation failure.
- redirect() : void
- Send an HTTP redirect.
- requirePermission() : void
- Require that the authenticated client user has a specific permission.
- url() : string
- Generate a full URL for a given path.
- view() : void
- Render a view template wrapped in a layout.
- validateClientForm() : array<string|int, mixed>
- Validate client form input for create/edit.
Constants
CSV_FIELDS
private
array<string|int, mixed>
CSV_FIELDS
= ['id', 'name', 'slug', 'business_type', 'description', 'tagline', 'address_street', 'address_city', 'address_state', 'address_zip', 'phone', 'email', 'website_url', 'social_facebook', 'social_instagram', 'social_twitter', 'social_tiktok', 'accepts_cash', 'accepts_card_onsite', 'accepts_online_payment', 'tax_rate', 'currency', 'timezone', 'order_lead_time', 'default_asap_delay', 'site_status', 'subscription_tier', 'accepts_reservations', 'reservation_duration_minutes', 'reservation_buffer_minutes', 'max_party_size', 'min_party_size', 'reservation_lead_hours', 'reservation_advance_days']
CSV-exportable fields for client store settings
Properties
$layout
protected
string
$layout
= 'admin'
Layout for admin pages
Methods
adminSettings()
Show the admin settings page.
public
adminSettings() : void
analytics()
Show platform-wide analytics.
public
analytics() : void
archiveClient()
Create a new archive for a client business.
public
archiveClient(string $id) : void
Parameters
- $id : string
-
Business ID
archiveDetail()
View details of a specific archive.
public
archiveDetail(string $dirName) : void
Parameters
- $dirName : string
-
Archive directory name
archives()
List all client data archives.
public
archives() : void
assignBusinessToGroup()
Assign a business to a group.
public
assignBusinessToGroup(string $id) : void
Parameters
- $id : string
-
Group ID
billing()
Show platform billing overview.
public
billing() : void
billingDetail()
Show billing detail for a specific business.
public
billingDetail(string $id) : void
Parameters
- $id : string
-
Business ID
blockedEmails()
Show blocked email addresses list.
public
blockedEmails() : void
blockedIps()
Show blocked IP addresses list.
public
blockedIps() : void
changePassword()
Show the change password form.
public
changePassword() : void
clientDetail()
Show detailed view for a single client business.
public
clientDetail(string $id) : void
Parameters
- $id : string
-
Business ID
clients()
Show enhanced client list with subscription and revenue data.
public
clients() : void
clientsCsv()
Show the CSV import/export page.
public
clientsCsv() : void
createClient()
Show the create client form.
public
createClient() : void
createGroup()
Show the create group form.
public
createGroup() : void
createInvoice()
Show the manual invoice creation form.
public
createInvoice(string $id) : void
Parameters
- $id : string
-
Business ID
deleteArchive()
Delete an archive.
public
deleteArchive(string $dirName) : void
Parameters
- $dirName : string
-
Archive directory name
deleteBlockedEmail()
Unblock an email address.
public
deleteBlockedEmail(string $id) : void
Parameters
- $id : string
-
Blocked email record ID
deleteBlockedIp()
Unblock an IP address.
public
deleteBlockedIp(string $id) : void
Parameters
- $id : string
-
Blocked IP record ID
deleteClient()
Delete a client business and all associated data.
public
deleteClient(string $id) : void
Parameters
- $id : string
-
Business ID
deleteGroup()
Delete a business group (unassigns all businesses first).
public
deleteGroup(string $id) : void
Parameters
- $id : string
-
Group ID
downloadArchive()
Download an archive as a ZIP file.
public
downloadArchive(string $dirName) : void
Parameters
- $dirName : string
-
Archive directory name
downloadCsvTemplate()
Download a blank CSV template for importing client settings.
public
downloadCsvTemplate() : void
editClient()
Show the edit client form.
public
editClient(string $id) : void
Parameters
- $id : string
-
Business ID
editGroup()
Show the edit group form.
public
editGroup(string $id) : void
Parameters
- $id : string
-
Group ID
exportClientsCsv()
Export all client store settings as a CSV download.
public
exportClientsCsv() : void
extendTrial()
Extend a business trial period.
public
extendTrial(string $id) : void
Parameters
- $id : string
-
Business ID
groupDetail()
View a business group's details.
public
groupDetail(string $id) : void
Parameters
- $id : string
-
Group ID
groups()
List all business groups.
public
groups() : void
importClientsCsv()
Import client store settings from an uploaded CSV file.
public
importClientsCsv() : void
Creates new businesses for rows without an ID, updates existing ones.
index()
Show the admin dashboard with all client businesses.
public
index() : void
loginAsClient()
Impersonate a client (login as a business owner).
public
loginAsClient(string $id) : void
Parameters
- $id : string
-
Business ID
loginAsCustomer()
Impersonate a customer (admin action).
public
loginAsCustomer(string $id) : void
Parameters
- $id : string
-
Customer ID
markInvoicePaid()
Mark an invoice as paid (admin override).
public
markInvoicePaid(string $invoiceId) : void
Parameters
- $invoiceId : string
-
Invoice ID
modules()
Show module manager page with pricing and tier assignments.
public
modules() : void
overrideSiteMode()
Override a business site mode (admin action).
public
overrideSiteMode(string $id) : void
Parameters
- $id : string
-
Business ID
overrideSuspend()
Suspend a business for non-payment (admin action).
public
overrideSuspend(string $id) : void
Parameters
- $id : string
-
Business ID
removeBusinessFromGroup()
Remove a business from a group.
public
removeBusinessFromGroup(string $id, string $businessId) : void
Parameters
- $id : string
-
Group ID
- $businessId : string
-
Business ID
saveAdminSettings()
Save admin settings (language preference).
public
saveAdminSettings() : void
savePassword()
Process the password change.
public
savePassword() : void
sendInvoiceEmail()
Send (or re-send) an invoice email to the business owner.
public
sendInvoiceEmail(string $invoiceId) : void
Parameters
- $invoiceId : string
-
Invoice ID
stopImpersonation()
Stop the current impersonation session (admin action).
public
stopImpersonation() : void
storeBlockedEmail()
Block a new email address.
public
storeBlockedEmail() : void
storeBlockedIp()
Block a new IP address.
public
storeBlockedIp() : void
storeClient()
Store a new client business and owner account.
public
storeClient() : void
storeGroup()
Store a new business group.
public
storeGroup() : void
storeInvoice()
Store a manually created invoice.
public
storeInvoice(string $id) : void
Parameters
- $id : string
-
Business ID
toggleModule()
Toggle a feature module for a business (admin override).
public
toggleModule(string $id) : void
Parameters
- $id : string
-
Business ID
updateClient()
Update an existing client business and owner account.
public
updateClient(string $id) : void
Parameters
- $id : string
-
Business ID
updateGroup()
Update a business group.
public
updateGroup(string $id) : void
Parameters
- $id : string
-
Group ID
updateModulePricing()
Update module pricing.
public
updateModulePricing(string $id) : void
Parameters
- $id : string
-
Module pricing record ID
voidInvoice()
Void an invoice (admin action).
public
voidInvoice(string $invoiceId) : void
Parameters
- $invoiceId : string
-
Invoice ID
zipcodeLookup()
Look up city and state by ZIP code.
public
zipcodeLookup() : void
baseUrl()
Get the base URL for the application.
protected
baseUrl() : string
Return values
stringbuildPagination()
Build pagination metadata for views.
protected
buildPagination(int $total, int $page, int $perPage, string $baseUrl) : array<string|int, mixed>
Parameters
- $total : int
-
Total record count
- $page : int
-
Current page number
- $perPage : int
-
Records per page
- $baseUrl : string
-
Base URL path (e.g., "client/orders")
Return values
array<string|int, mixed> —Pagination metadata
clearOldInput()
Clear stored old input data.
protected
clearOldInput() : void
flash()
Set a flash message in the session.
protected
flash(string $key, string $message) : void
Parameters
- $key : string
-
Flash message key (e.g., "success", "error")
- $message : string
-
The message text
flashOldInput()
Store current POST data as old input for form repopulation.
protected
flashOldInput() : void
getPage()
Get the current page number from the query string.
protected
getPage() : int
Return values
int —Page number (minimum 1)
json()
Send a JSON response.
protected
json(mixed $data[, int $status = 200 ]) : void
Parameters
- $data : mixed
-
Data to encode as JSON
- $status : int = 200
-
HTTP status code
old()
Get previous form input after validation failure.
protected
old(string $field[, mixed $default = '' ]) : mixed
Parameters
- $field : string
-
The form field name
- $default : mixed = ''
-
Default value if not found
redirect()
Send an HTTP redirect.
protected
redirect(string $url) : void
Parameters
- $url : string
-
The URL to redirect to
requirePermission()
Require that the authenticated client user has a specific permission.
protected
requirePermission(string $permission) : void
Redirects to the client dashboard with an error flash if denied.
Parameters
- $permission : string
-
Permission key (e.g., 'menu_manage')
url()
Generate a full URL for a given path.
protected
url([string $path = '' ]) : string
Parameters
- $path : string = ''
-
The path to append to the base URL
Return values
stringview()
Render a view template wrapped in a layout.
protected
view(string $template[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $template : string
-
Path to view relative to app/Views/ (e.g., "admin/dashboard")
- $data : array<string|int, mixed> = []
-
Variables to extract into the view scope
validateClientForm()
Validate client form input for create/edit.
private
validateClientForm(bool $isEdit[, int|null $businessId = null ]) : array<string|int, mixed>
Parameters
- $isEdit : bool
-
Whether this is an edit (password optional)
- $businessId : int|null = null
-
Business ID for edit (to exclude from email uniqueness check)
Return values
array<string|int, mixed> —List of error messages