Skip to content

Commit 17a26b9

Browse files
authored
fix(prompts): adding ID Url attribute to prompts (#1167)
* fix(models): Adding IdUrl to Prompts * Let's actually add a use. * Forgot proper allocation
1 parent b068532 commit 17a26b9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/Models/Prompt/Prompt.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ public function getUrlAttribute() {
289289
return url('prompts/prompts?name='.$this->name);
290290
}
291291

292+
/**
293+
* Gets the URL of the individual prompt's page, by ID.
294+
*
295+
* @return string
296+
*/
297+
public function getIdUrlAttribute() {
298+
return url('prompts/'.$this->id);
299+
}
300+
292301
/**
293302
* Gets the prompt's asset type for asset management.
294303
*

resources/views/prompts/_prompt_entry.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
<x-admin-edit title="Prompt" :object="$prompt" />
77
<div class="mb-3">
88
@if (isset($isPage))
9-
<h1 class="mb-0">{!! $prompt->name !!}</h1>
9+
<h1 class="mb-0">{!! $prompt->name !!} <a href="{{ $prompt->$idUrl }}" class="world-entry-search text-muted"><i class="fas fa-search"></i></a></h1>
1010
@else
11-
<h2 class="mb-0"><a href="{{ url('prompts/' . $prompt->id) }}">{!! $prompt->name !!}</a></h2>
11+
<h2 class="mb-0"><a href="{{ $prompt->$idUrl }}">{!! $prompt->name !!}</a></h2>
1212
@endif
1313
@if ($prompt->prompt_category_id)
1414
<div><strong>Category: </strong>{!! $prompt->category->displayName !!}</div>

0 commit comments

Comments
 (0)