Skip to content

Views: Actions #4

@ibnnajjaar

Description

@ibnnajjaar
  • In the actions part, add condition around update and view method to not show it when the user is in the respective route. For example

Current

        @can('update', $waste_collection)
            <a class="actions__item zmdi zmdi-edit" href="{{ route('admin.waste-collections.edit', $waste_collection) }}" title="Edit">
                <span>{{ __('Edit') }}</span>
            </a>
        @endcan

        @can('view', $waste_collection)
            <a class="actions__item zmdi zmdi-eye" href="{{ route('admin.waste-collections.show', $waste_collection) }}" title="View">
                <span>{{ __('View') }}</span>
            </a>
        @endcan

Expected

        @if (! request()->routeIs('admin.waste-collections.edit'))
            @can('update', $waste_collection)
                <a class="actions__item zmdi zmdi-edit" href="{{ route('admin.waste-collections.edit', $waste_collection) }}" title="Edit">
                    <span>{{ __('Edit') }}</span>
                </a>
            @endcan
        @endif

        @if (! request()->routeIs('admin.waste-collections.show'))
            @can('view', $waste_collection)
                <a class="actions__item zmdi zmdi-eye" href="{{ route('admin.waste-collections.show', $waste_collection) }}" title="View">
                    <span>{{ __('View') }}</span>
                </a>
            @endcan
        @endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions