From ba24f6ccfaa572aecb826236e5a029b6ba7b8310 Mon Sep 17 00:00:00 2001 From: owlana <40763849+owlana@users.noreply.github.com> Date: Sun, 21 Jul 2024 00:55:28 +0300 Subject: [PATCH] fix usage IconComponent render function (#10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Верхотурова Анастасия --- src/IconComponent.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IconComponent.php b/src/IconComponent.php index a96984b..b9ebf02 100644 --- a/src/IconComponent.php +++ b/src/IconComponent.php @@ -89,10 +89,10 @@ public function __construct( */ public function render(): callable { - return function (array $data) { + return function (array $data = []) { return view('blade-icon::icon', [ 'html' => $this->finder->loadFile($this->path), - 'data' => collect($this->extractPublicProperties())->merge($data['attributes'])->filter(fn($value) => is_string($value)), + 'data' => collect($this->extractPublicProperties())->merge($data['attributes'] ?? [])->filter(fn($value) => is_string($value)), ]); }; }