Skip to content

jbumaniss/resource-navigation-link

 
 

Repository files navigation

Resource Navigation Link

Latest Version on Packagist Total Downloads License

This package is very similar to the https://github.com/dcasia/resource-navigation-tab (visually they are identical) however internally they works differently.

The main difference is that this package is a Card (not a field), and it links to other resources instead of filtering the current resource

Installation

You can install the package via composer:

composer require digital-creative/resource-navigation-link

Basic Usage

use DigitalCreative\ResourceNavigationLink\ResourceNavigationLink;
use DigitalCreative\ResourceNavigationLink\Link;
use Laravel\Nova\Http\Requests\NovaRequest;

class User extends Resource {

    public function cards(NovaRequest $request): array
    {
        return [
            ResourceNavigationLink::make([
                Link::toResourceIndex(User::class),
                Link::toResourceIndex(Article::class),
                Link::toLens(Article::class, MostViewed::class),
                Link::toExternalUrl('Documentation', 'https://laravel.com/docs/10.x/readme'),
            ]),
        ];
    }

}

/**
 * Optional: if you want to copy the navigation links from another resource
 */
class Article extends Resource {

    public function cards(NovaRequest $request): array
    {
        return [
            ...ResourceNavigationLink::copyFromResource(User::class),
        ];
    }

}

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

Other Packages You Might Like

License

The MIT License (MIT). Please see License File for more information.

About

Create links to internal or external resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 69.4%
  • Vue 15.6%
  • JavaScript 14.6%
  • CSS 0.4%