1. Go to this page and download the library: Download wehaa/custom-links 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/ */
wehaa / custom-links example snippets
// in app/Providers/NovaServiceProvider.php
use Wehaa\CustomLinks\CustomLinks;
// ...
public function tools()
{
return [
// ...
new CustomLinks(),
];
}
return [
'links' => [
'{TEXT}' => [ // Top level section title text
'_can' => '{PERMISSION}' // The name of the permission
'_icon' => '{ICON}', // SVG icon code (optional)
'_url' => '{URL}', // URL (optional if _links is present)
'_target' => '{TARGET}', // Link target (optional)
'_links' => [ // Section extra links (optional if _url is present
'{TEXT}' => [ // Sub section text
'_can' => '{PERMISSION}' // The name of the permission
'_url' => '{URL}', // URL
'_target' => '{TARGET}', // Link target (optional)
]
]
]
]
];
// in app/Providers/NovaServiceProvider.php
use Wehaa\CustomLinks\CustomLinks;
// ...
public function tools()
{
return [
// ...
(new CustomLinks)->canSee(function ($request) {
return false;
}),
];
}
return [
'links' => [
'{TEXT}' => [ // Top level section title text
'_can' => '{PERMISSION}' // Checks if the link and sublinks can be shown
// ...
'_links' => [ // Section extra links (optional if _url is present
'{TEXT}' => [ // Sub section text
'_can' => '{PERMISSION}' // Checks if the link can be shown
// ...
]
]
]
]
];