Search⌘ K

List Orders of a Restaurant

Explore how to implement API endpoints in Laravel to fetch open and completed orders for a restaurant. Learn to apply Eloquent query scopes for cleaner code and test your endpoints using Postman with proper authentication.

New URLs

We should let the user fetch the list of open orders and the list of completed orders of a restaurant.

<?php
// ...
    Route::prefix('orders')->group(function () {
        Route::get('/list-open', [OrderController::class, 'listOpen']);
        Route::get('/list-completed', [OrderController::class, 'listCompleted']);
        // ...
    });
// ...

Query scopes

Time to learn one more ...