Merge pull request #18667 from marcusmoore/migrate-link-methods

Fixed #18666: Migrate Laravel Collective helper methods
This commit is contained in:
snipe
2026-03-11 10:14:31 +00:00
committed by GitHub
20 changed files with 21 additions and 33 deletions

View File

@@ -265,7 +265,7 @@ class AccessoryPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Accessory', $this])) {
return (string)link_to_route('accessories.show', e($this->display_name), $this->id);
return '<a href="' . route('accessories.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -22,9 +22,6 @@ class ActionlogPresenter extends Presenter
public function item()
{
if ($this->action_type == 'uploaded') {
return (string) link_to_route('show/userfile', $this->model->filename, [$this->model->item->id, $this->model->id]);
}
if ($item = $this->model->item) {
if (empty($item->deleted_at)) {
return $this->model->item->present()->nameUrl();

View File

@@ -266,7 +266,7 @@ class AssetModelPresenter extends Presenter
*/
public function nameUrl()
{
return (string) link_to_route('models.show', $this->name, $this->id);
return '<a href="' . route('models.show', $this->id) . '">' . e($this->name) . '</a>';
}
/**

View File

@@ -452,7 +452,7 @@ class AssetPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Asset', $this])) {
return (string)link_to_route('hardware.show', e($this->display_name), $this->id);
return '<a href="' . route('hardware.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -143,7 +143,7 @@ class CategoryPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
return (string)link_to_route('categories.show', e($this->display_name), $this->id);
return '<a href="' . route('categories.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -166,7 +166,7 @@ class CompanyPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Company', $this])) {
return (string)link_to_route('companies.show', e($this->display_name), $this->id);
return '<a href="' . route('companies.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -257,7 +257,7 @@ class ComponentPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Component', $this])) {
return (string)link_to_route('components.show', e($this->display_name), $this->id);
return '<a href="' . route('components.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -255,6 +255,6 @@ class ConsumablePresenter extends Presenter
*/
public function nameUrl()
{
return (string) link_to_route('consumables.show', e($this->name), $this->id);
return '<a href="' . route('consumables.show', $this->id) . '">' . e($this->name) . '</a>';
}
}

View File

@@ -12,7 +12,7 @@ class CustomFieldsetPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\CustomFieldset', $this])) {
return (string)link_to_route('fieldsets.show', e($this->display_name), $this->id);
return '<a href="' . route('fieldsets.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -125,8 +125,8 @@ class DepartmentPresenter extends Presenter
*/
public function viewUrl()
{
if (auth()->user()->can('view', ['\App\Models\Location', $this])) {
return (string)link_to_route('locations.show', $this->display_name, $this->id);
if (auth()->user()->can('view', ['\App\Models\Department', $this])) {
return '<a href="' . route('departments.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return $this->display_name;
}

View File

@@ -111,7 +111,7 @@ class DepreciationPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Depreciation', $this])) {
return (string)link_to_route('depreciations.show', e($this->display_name), $this->id);
return '<a href="' . route('depreciations.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -181,7 +181,7 @@ class DepreciationReportPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Depreciation', $this])) {
return (string)link_to_route('depreciations.show', e($this->display_name), $this->id);
return '<a href="' . route('depreciations.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -323,7 +323,7 @@ class LicensePresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\License', $this])) {
return (string)link_to_route('licenses.show', e($this->display_name), $this->id);
return '<a href="' . route('licenses.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}
@@ -339,15 +339,6 @@ class LicensePresenter extends Presenter
return $this->name;
}
/**
* Link to this licenses serial
* @return string
*/
public function serialUrl()
{
return (string) link_to('/licenses/'.$this->id, mb_strimwidth($this->serial, 0, 50, '...'));
}
/**
* Url to view this item.
* @return string

View File

@@ -351,7 +351,7 @@ class LocationPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Location', $this])) {
return (string)link_to_route('locations.show', e($this->display_name), $this->id);
return '<a href="' . route('locations.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -184,7 +184,7 @@ class ManufacturerPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Manufacturer', $this])) {
return (string)link_to_route('manufacturers.show', e($this->display_name), $this->id);
return '<a href="' . route('manufacturers.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -296,7 +296,7 @@ class PredefinedKitPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\PredefinedKit', $this])) {
return (string)link_to_route('kits.show', e($this->display_name), $this->id);
return '<a href="' . route('kits.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -210,7 +210,7 @@ class SupplierPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\Supplier', $this])) {
return (string)link_to_route('suppliers.show', e($this->display_name), $this->id);
return '<a href="' . route('suppliers.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}
@@ -232,7 +232,7 @@ class SupplierPresenter extends Presenter
public function viewUrl()
{
if (auth()->user()->can('view', ['\App\Models\Supplier', $this])) {
return (string)link_to_route('suppliers.show', $this->display_name, $this->id);
return '<a href="' . route('suppliers.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -529,7 +529,7 @@ class UserPresenter extends Presenter
public function nameUrl()
{
if (auth()->user()->can('view', ['\App\Models\User', $this])) {
return (string)link_to_route('users.show', $this->display_name, $this->id);
return '<a href="' . route('users.show', $this->id) . '">' . e($this->display_name) . '</a>';
} else {
return e($this->display_name);
}

View File

@@ -51,7 +51,7 @@
@foreach($custom_fieldsets AS $fieldset)
<tr>
<td>
{{ link_to_route("fieldsets.show",$fieldset->name,['fieldset' => $fieldset->id]) }}
<a href="{{ route('fieldsets.show', ['fieldset' => $fieldset->id]) }}">{{ $fieldset->name }}</a>
</td>
<td>
{{ $fieldset->fields->count() }}

View File

@@ -553,7 +553,7 @@
{!! $asset->checkInvalidNextAuditDate() ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
{{ Helper::getFormattedDateObject($audit_log->created_at, 'datetime', false) }}
@if ($audit_log->user)
({{ link_to_route('users.show', $audit_log->user->display_name, [$audit_log->user->id]) }})
(<a href="{{ route('users.show', $audit_log->user->id) }}">{{ $audit_log->user->display_name }}</a>)
@endif
</div>