Skip to content

Commit

Permalink
added value to component
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamfast committed Aug 13, 2020
1 parent 948d65e commit a57c535
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/GameController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ public function show($slug)
$endpoint = "https://api-v3.igdb.com/games";
$game = Http::withHeaders(config('services.igdb'))->withOptions([
'body' => "
fields name, cover.*, first_release_date, popularity,platforms.abbreviation,rating, slug;
fields *, name, cover.*, first_release_date, popularity,platforms.abbreviation,rating, slug, involved_companies.company.*, genres.*;
where slug = \"{$slug}\";
"
])->get($endpoint)->json();

abort_if(!$game, 404);

dump($game);

return view('show', [
'game' => $game
'game' => $game[0]
]);
}

Expand Down
18 changes: 13 additions & 5 deletions resources/views/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@
<div class="container mx-auto px-4">
<div class="game-details border-b border-gray-800 pb-12 flex flex-col lg:flex-row">
<div class="flex-none">
<img src="/img/gg1.jpg" alt="cover" class="">
<img src="{{ Str::replaceFirst('thumb', 'cover_big', $game['cover']['url']) }}" alt="cover" class="">
</div>
<div class="lg:ml-12 lg:mr-64">
<h2 class="font-semibold text-4xl leading-tight mt-1">
Final Fantesy
{{ $game['name'] }}
</h2>
<div class="text-gray-400">
<span>Adventure, RPG</span>
<span>
@foreach($game['genres'] as $genre)
{{ $genre['name'] }},
@endforeach
</span>
&middot;
<span>Square, Enix</span>
<span>{{ $game['involved_companies'][0]['company']['name'] }}</span>
&middot;
<span>Playstation 4</span>
@foreach($game['platforms'] as $platform)
@if(array_key_exists('abbreviation', $platform))
{{ $platform['abbreviation'] }}
@endif
@endforeach
</div>
<div class="flex flex-wrap items-center mt-8">
<div class="flex items-center">
Expand Down

0 comments on commit a57c535

Please sign in to comment.