PHP code example of digital-creative / resource-navigation-link
1. Go to this page and download the library: Download digital-creative/resource-navigation-link library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
digital-creative / resource-navigation-link example snippets
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),
];
}
}