From f1a1e988c4a8c19a677a489b2fafdf3412863b8e Mon Sep 17 00:00:00 2001
From: K Miyano
Date: Sat, 1 May 2021 00:56:36 +0900
Subject: [PATCH] Add icon fetch process & update main.home.blade
---
app/Http/Controllers/InfoController.php | 13 ++++++++++++-
resources/views/main/home.blade.php | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/InfoController.php b/app/Http/Controllers/InfoController.php
index 64c9b618..bd50f731 100644
--- a/app/Http/Controllers/InfoController.php
+++ b/app/Http/Controllers/InfoController.php
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
+use App\Models\Image;
use Carbon\Carbon;
use Exception;
use ZipArchive;
@@ -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(){
diff --git a/resources/views/main/home.blade.php b/resources/views/main/home.blade.php
index 81e19e15..0a8095ff 100644
--- a/resources/views/main/home.blade.php
+++ b/resources/views/main/home.blade.php
@@ -102,7 +102,7 @@
@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
該当するデータがありません
@endforelse