Search⌘ K

Transitioning Table States

Explore how to implement API endpoints that manage table state transitions in a restaurant system using Laravel. Learn to control states such as Available, Reserved, and Non-operational, ensure state transitions are valid, and apply testing to verify functionality for reliable API behavior.

New API endpoints

Now that we have set up the table state rules, we can add new API endpoints that will allow users to change the state of a table.

<?php 
// ...
Route::post('/mark-as-non-operational/{tableId}', [TableStatusController::class, 'markAsNonOperational']);
            Route::post('/mark-as-available/{tableId}', [TableStatusController::class, 'markAsAvailable']);
            Route::post('/mark-as-reserved/{tableId}', [TableStatusController::class,
...