diff --git a/config/config.php b/config/config.php index 10a4b1a..549ef98 100644 --- a/config/config.php +++ b/config/config.php @@ -130,6 +130,7 @@ 'references-nullable' => true, /* * Ether you define your models for references or customize the view. + * Example: [App/Models/User::class] */ 'reference-models' => [] ]; diff --git a/resources/views/tickets/create.blade.php b/resources/views/tickets/create.blade.php index f2573db..369b71e 100644 --- a/resources/views/tickets/create.blade.php +++ b/resources/views/tickets/create.blade.php @@ -47,10 +47,11 @@ @if (!$model->hasReferenceAccess()) @continue @endif - + @endforeach @endforeach diff --git a/resources/views/tickets/show.blade.php b/resources/views/tickets/show.blade.php index f75a210..643e6f4 100644 --- a/resources/views/tickets/show.blade.php +++ b/resources/views/tickets/show.blade.php @@ -92,7 +92,7 @@ class="custom-file-input @error('files') is-invalid @enderror" id="files"> @php($referenceable = $ticket->reference->referenceable) + value="{{ $referenceable->toReference() }}" disabled> @endif
diff --git a/src/Helper/ReferenceHelper.php b/src/Helper/ReferenceHelper.php new file mode 100644 index 0000000..46deb5f --- /dev/null +++ b/src/Helper/ReferenceHelper.php @@ -0,0 +1,17 @@ +id"; + } + + +} diff --git a/src/Interfaces/TicketReference.php b/src/Interfaces/TicketReference.php index 93b3eee..6aaec41 100644 --- a/src/Interfaces/TicketReference.php +++ b/src/Interfaces/TicketReference.php @@ -15,7 +15,7 @@ interface TicketReference function hasReferenceAccess() : bool; /** - * Combine type and id to a string for forms + * Show the name when on selection * * @return string */ diff --git a/src/Traits/HasTicketReference.php b/src/Traits/HasTicketReference.php index 696baee..9ff64cc 100644 --- a/src/Traits/HasTicketReference.php +++ b/src/Traits/HasTicketReference.php @@ -9,8 +9,8 @@ trait HasTicketReference public function toReference() : string { - $type = get_class($this); - return "$type,$this->id"; + $type = basename(get_class($this)); + return "$type #$this->id"; } }