PHP code example of uptoolkit / laravel-categories

1. Go to this page and download the library: Download uptoolkit/laravel-categories 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/ */

    

uptoolkit / laravel-categories example snippets


php artisan vendor:publish --provider="Uptoolkit\Categories\CategoriesServiceProvider" && php artisan migrate
 php
$post->categoriesList();
 php
$post->syncCategories([]);
 php
$post->assignCategory(Category::find(1));
 php
$post->removeCategory(Category::find(1));
 php
Category::first()->entries(Post::class)->get();