Field Manual Brokerage / Linux / Laravel
← Laravel

app/Http/Controllers/MarketController.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/MarketController.php

Example

<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use App\Services\ExchangeClient;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;

class MarketController extends Controller
{
    public function index(): View
    {
        return view('market', ['demo' => config('services.exchange.demo')]);
    }

    public function data(ExchangeClient $exchange): JsonResponse
    {
        return response()->json($exchange->marketData());
    }
}

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.

Related topics

API contract: change these points first