Laravel Projects Examples

Vending Machine Laravel API with Filament Adminpanel

A project based on a real Upwork job: Employee Purchase System via Access Card and Self-Service Vending Machines.

Here's the link to the PDF of that Upwork job.

The system consists of two main components: a Laravel API for processing purchases and a Filament admin panel for managing the system.

API Purchase Flow

The system processes purchases through a single API endpoint (/api/purchase) which handles the following flow in the app/Http/Controllers/API/PurchaseController.php Controller:

public function process(PurchaseRequest $request): JsonResponse
{
$data = $request->validated();
$transactionTime = $data['timestamp'] ?? now();
 
return DB::transaction(function () use ($data, $transactionTime) {
// Implementation of the purchase flow...
});
}

On top, it has a lot of validation logic.

  1. Validates the incoming request (card number, machine ID, slot number, product price). Validation is handled by the...

Want to get the access to GitHub repository?

Become a Premium Member for $129/year or $29/month