PHP code example of binomeway / nova-taxonomies-tool
1. Go to this page and download the library: Download binomeway/nova-taxonomies-tool 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/ */
binomeway / nova-taxonomies-tool example snippets
public function tools(){
return [
\BinomeWay\NovaTaxonomiesTool\NovaTaxonomiesTool::make(),
];
}
use \BinomeWay\NovaTaxonomiesTool\Facades\Taxonomies;
public function boot() {
Taxonomies::addType('categories', 'Categories');
// or multiple
Taxonomies::addTypes([
'name' => 'Display Name',
'colors' => 'Colors',
'types' => 'Types',
]);
}
use BinomeWay\NovaTaxonomiesTool\Nova\Actions\UpdateTag;
function actions(Request $request) {
return [
// This will result in have the default button Update Tag
UpdateTag::make('categories'), // Update Tag
// You can Override the label using the constructor or the 'withLabel' method
UpdateTag::make('categories', 'Categories') // Update Categories
// alternative
->withLabel('Categories'), // Will produce same result: Update Categories
// If you want to override the name entirely use the 'withName' method
UpdateTag::make('categories')->withName('My Action Name')
];
}
use BinomeWay\NovaTaxonomiesTool\Nova\Actions\UpdateSingleTag;
public function actions(Request $request) {
return [
UpdateSingleTag::make('status', 'Status'),
];
}
use BinomeWay\NovaTaxonomiesTool\Nova\Filters\SingleTag;
public function filters(Request $request)
{
return [
SingleTag::make()
->withName(__('By Status')) // Override the displayed name
->withTagType('status')
];
}
use BinomeWay\NovaTaxonomiesTool\Nova\Filters\MultiTags;
public function filters(Request $request)
{
return [
MultiTags::make()
->withName(__('By Position'))
->withTagType('page-position'),
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.