Skip to content

Commit 6455098

Browse files
committed
if type not exist show the current value on TypeColumn
1 parent 1182d0c commit 6455098

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

resources/views/columns/type-column.blade.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,18 @@
5252
5353
$arrayState = \Illuminate\Support\Arr::wrap($arrayState);
5454
$type = \TomatoPHP\FilamentTypes\Models\Type::where('key', $arrayState[0])->first();
55-
$arrayState[0] = $type->name;
55+
if($type){
56+
$arrayState[0] = $type->name;
57+
58+
$hex = $type->color;
59+
list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
60+
$colorRGB= array($r, $g, $b);
61+
}
62+
else {
63+
$arrayState[0] = $arrayState[0];
64+
$colorRGB = [0,0,0];
65+
}
5666
57-
$hex = $type->color;
58-
list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x");
59-
$colorRGB= array($r, $g, $b);
6067
@endphp
6168

6269
<div
@@ -121,12 +128,12 @@
121128
@if (filled($formattedState = $formatState($state)) &&
122129
(! ($isListWithLineBreaks && (! $isLimitedListExpandable) && ($loop->iteration > $listLimit))))
123130
@php
124-
$color = $type->color;
131+
$color = $type->color ?? null;
125132
$copyableState = $getCopyableState($state) ?? $state;
126133
$copyMessage = $getCopyMessage($state);
127134
$copyMessageDuration = $getCopyMessageDuration($state);
128135
$fontFamily = $getFontFamily($state);
129-
$icon = $type->icon;
136+
$icon = $type->icon ?? null;
130137
$iconColor = $getIconColor($state) ?? $color;
131138
$itemIsCopyable = $isCopyable($state);
132139
$lineClamp = $getLineClamp($state);

0 commit comments

Comments
 (0)