Reputation: 39
I have a subpage that draws the letters for each table. For example, I give 1, 2, 3, 4, 5 and a, b, c. Below is the code that processes the result:
@extends('layout')
@section('content')
<div class="card mt-5">
<div class="card-header" style="z-index: 1000;">
<h2>Results {{response()->json([$teams_json])->getContent()}}</h2>
</div>
</div>
@endsection
The result of the JSON response:
Result: [{"a":["2","3"],"b":["1","5"],"c":["4"]}]
How can I format my result to look like this?
Result:
- a: 2,3
- b: 1,5
- c: 4
Upvotes: 0
Views: 68
Reputation: 2158
You'll have to loop it and print them the way you wish. Since you're using Blade, you can use @foreach
.
Try the following:
@extends('layout')
@section('content')
<div class="card mt-5">
<div class="card-header" style="z-index: 1000;">
<h2>Results {{response()->json([$teams_json])->getContent()}}</h2>
@foreach ($teams_json as $team => $no)
{{ $team }}: {{ implode($no) }}
@endforeach
</div>
</div>
@endsection
Upvotes: 1