app/Http/Controllers/OrderController.php
Paste the complete file at this path. Names and paths are case-sensitive on Linux.
What it is
Complete brokerage practice file. The Assemble project page lists every file in order.
When to use it
Paste the complete file at this path. Names and paths are case-sensitive on Linux.
Syntax
mkdir -p 'app/Http/Controllers'
# Paste the Example below into app/Http/Controllers/OrderController.phpExample
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Http\Requests\StoreOrderRequest;
use App\Services\OrderService;
use Illuminate\Http\JsonResponse;
class OrderController extends Controller
{
public function store(StoreOrderRequest $request, OrderService $orders): JsonResponse
{
$order = $orders->place($request->validated());
return response()->json([
'message' => 'Order accepted.',
'exchange_order_id' => $order->exchange_order_id,
], 201);
}
}
Common mistakes
Use the setup runbook first. Adapt provisional API assumptions to the supplied contract. Merge into supplied applications; do not duplicate the orders migration.