Skip to content

Commit

Permalink
Add icon fetch process & update main.home.blade
Browse files Browse the repository at this point in the history
  • Loading branch information
miyacorata committed Apr 30, 2021
1 parent 07e0e77 commit f1a1e98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion app/Http/Controllers/InfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers;

use App\Models\Image;
use Carbon\Carbon;
use Exception;
use ZipArchive;
Expand Down Expand Up @@ -54,9 +55,19 @@ public function index(){
}
}

$image_pull_list = array();
$images = array();
foreach ($lilies as $key => $lily){
$image_pull_list[] = str_replace('lilyrdf:','',$key);
}
foreach (Image::whereType('icon')->whereIn('for',$image_pull_list)->get() as $image){
$images['lilyrdf:'.$image->for][] = $image;
}

$birthday = $lilies;
//dd($images);

return view('main.home', compact('rdf_feed', 'birthday', 'legions'));
return view('main.home', compact('rdf_feed', 'birthday', 'legions', 'images'));
}

public function menu(){
Expand Down
2 changes: 1 addition & 1 deletion resources/views/main/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</p>
<div class="list" style="justify-content: space-around">
@forelse($birthday as $key => $lily)
@include('app.button_lily',['key' => $key, 'lily' => $lily, 'legion' => $legions[$lily['lily:legion'][0]] ?? array()])
@include('app.button_lily',['key' => $key, 'lily' => $lily, 'legion' => $legions[$lily['lily:legion'][0]] ?? array(), 'icons' => $images[$key] ?? array()])
@empty
<p style="text-align: center; color: darkred; margin: 3em auto">該当するデータがありません</p>
@endforelse
Expand Down

0 comments on commit f1a1e98

Please sign in to comment.