PHP code example of webwizardsusa / laravel-taxonomy
1. Go to this page and download the library: Download webwizardsusa/laravel-taxonomy 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/ */
webwizardsusa / laravel-taxonomy example snippets
use Webwizardsusa\Taxonomy\Vocabulary;
class TagsVocabulary extends Vocabulary
{
public static function key(): string
{
return 'tags';
}
public function label(): string
{
return 'Tags';
}
public function isOpen(): bool
{
return true;
}
}
$post->syncTerms('tags', ['PHP', 'Laravel']);
Post::withAnyTerms(['php'], 'tags')->get();
bash
composer vendor:publish --tag=taxonomy-config
php artisan vendor:publish --tag=taxonomy-migrations
php artisan migrate