OrderController
extends Controller
in package
Client order management controller.
Allows restaurant owners to view, manage, and update order statuses.
Tags
Table of Contents
Properties
- $layout : string
Methods
- apiActiveOrders() : void
- API endpoint: return active orders as JSON for polling.
- apiUpdateStatus() : void
- API endpoint: update order status via AJAX POST.
- assignStaff() : void
- Assign a staff member to an order.
- exportCsv() : void
- Export orders as CSV.
- index() : void
- Show the order list with status tabs.
- live() : void
- Show the live orders board for real-time kitchen management.
- receipt() : void
- Show a printable receipt for an order.
- refund() : void
- Issue a refund, credit, or chargeback for an order or order item.
- refunds() : void
- Show all refunds for the business.
- search() : void
- Search orders.
- sendDelay() : void
- Send a delay notification SMS for an order.
- show() : void
- Show a single order detail.
- togglePause() : void
- Toggle the orders-paused flag for the business.
- unassignStaff() : void
- Unassign a staff member from an order.
- updateAsapDelay() : void
- Update the default ASAP pickup delay minutes.
- updateStatus() : void
- Update the status of an order.
- 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.
- sendReadySms() : void
- Send a "ready for pickup" SMS if SMS is enabled for the business.
Properties
$layout
protected
string
$layout
= 'client'
Layout for client pages
Methods
apiActiveOrders()
API endpoint: return active orders as JSON for polling.
public
apiActiveOrders() : void
apiUpdateStatus()
API endpoint: update order status via AJAX POST.
public
apiUpdateStatus() : void
assignStaff()
Assign a staff member to an order.
public
assignStaff(string $id) : void
Parameters
- $id : string
-
Order ID
exportCsv()
Export orders as CSV.
public
exportCsv() : void
index()
Show the order list with status tabs.
public
index() : void
live()
Show the live orders board for real-time kitchen management.
public
live() : void
receipt()
Show a printable receipt for an order.
public
receipt(string $id) : void
Parameters
- $id : string
-
Order ID
refund()
Issue a refund, credit, or chargeback for an order or order item.
public
refund(string $id) : void
Parameters
- $id : string
-
Order ID
refunds()
Show all refunds for the business.
public
refunds() : void
search()
Search orders.
public
search() : void
sendDelay()
Send a delay notification SMS for an order.
public
sendDelay(string $id) : void
Parameters
- $id : string
-
Order ID
show()
Show a single order detail.
public
show(string $id) : void
Parameters
- $id : string
-
Order ID
togglePause()
Toggle the orders-paused flag for the business.
public
togglePause() : void
unassignStaff()
Unassign a staff member from an order.
public
unassignStaff(string $id) : void
Parameters
- $id : string
-
Order ID
updateAsapDelay()
Update the default ASAP pickup delay minutes.
public
updateAsapDelay() : void
updateStatus()
Update the status of an order.
public
updateStatus(string $id) : void
Parameters
- $id : string
-
Order ID
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
sendReadySms()
Send a "ready for pickup" SMS if SMS is enabled for the business.
private
sendReadySms(array<string|int, mixed> $order, array<string|int, mixed> $business) : void
Parameters
- $order : array<string|int, mixed>
-
Order record
- $business : array<string|int, mixed>
-
Business record