From 11f5e2198f5597dcb3f8351147d0aef74c873b64 Mon Sep 17 00:00:00 2001 From: Diego Smania Date: Mon, 1 Jul 2024 11:14:16 -0300 Subject: [PATCH] [Components/ProfileWidget]: Allow changing default icon when no image is provided --- .../views/components/widget/profile-widget.blade.php | 4 ++-- src/View/Components/Widget/ProfileWidget.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/resources/views/components/widget/profile-widget.blade.php b/resources/views/components/widget/profile-widget.blade.php index b0dcdd2d..370440cb 100644 --- a/resources/views/components/widget/profile-widget.blade.php +++ b/resources/views/components/widget/profile-widget.blade.php @@ -9,11 +9,11 @@ User avatar: {{ $name }} @elseif($layoutType === 'modern')
- +
@elseif($layoutType === 'classic')
- +
@endisset diff --git a/src/View/Components/Widget/ProfileWidget.php b/src/View/Components/Widget/ProfileWidget.php index f41bbf6b..bbcf6e2a 100644 --- a/src/View/Components/Widget/ProfileWidget.php +++ b/src/View/Components/Widget/ProfileWidget.php @@ -28,6 +28,13 @@ class ProfileWidget extends Component */ public $img; + /** + * The default icon that will be used when no image is provided. + * + * @var string + */ + public $icon; + /** * The profile header theme (light, dark, primary, secondary, info, success, * warning, danger or any other AdminLTE color like lighblue or teal). @@ -73,11 +80,13 @@ class ProfileWidget extends Component */ public function __construct( $name = null, $desc = null, $img = null, $theme = null, $cover = null, - $headerClass = null, $footerClass = null, $layoutType = 'modern' + $headerClass = null, $footerClass = null, $layoutType = 'modern', + $icon = 'fas fa-user' ) { $this->name = UtilsHelper::applyHtmlEntityDecoder($name); $this->desc = UtilsHelper::applyHtmlEntityDecoder($desc); $this->img = $img; + $this->icon = $icon; $this->theme = $theme; $this->cover = $cover; $this->headerClass = $headerClass;