Skip to content

Commit 776ba93

Browse files
scott graysonscott grayson
authored andcommitted
->id of null fix
1 parent a41b868 commit 776ba93

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Resources/CourseResource.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ public static function form(Form $form): Form
5858
->options(config('filament-lms.awards'))
5959
->required()
6060
->hint(function ($record) {
61-
$link = route('filament-lms::certificates.show', ['course' => $record->id, 'user' => auth()->id()]);
61+
if ($record?->id) {
62+
$link = route('filament-lms::certificates.show', ['course' => $record->id, 'user' => auth()->id()]);
63+
return new HtmlString("<a rel='noopener noreferrer' target='_blank' href='{$link}'>Click to Preview</a>");
64+
}
6265

63-
return new HtmlString("<a rel='noopener noreferrer' target='_blank' href='{$link}'>Click to Preview</a>");
66+
return null;
6467
})
6568
->helperText('Form must be saved before previewing.'),
6669
Forms\Components\Checkbox::make('hidden'),

0 commit comments

Comments
 (0)