PHP code example of balajidharma / laravel-category

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

    

balajidharma / laravel-category example snippets



use BalajiDharma\LaravelCategory\Models\CategoryType;

CategoryType::create([
    'name' => 'Product Category',
    'machine_name' => 'product_category',
    'description' => 'Site Product Category',
]);

use BalajiDharma\LaravelCategory\Models\Category;

$items = (new Category)->toTree($type->id);

use BalajiDharma\LaravelCategory\Models\CategoryType;

$items = CategoryType::getCategoryTree('product_category');
bash
php artisan vendor:publish --provider="BalajiDharma\LaravelCategory\CategoryServiceProvider"
bash
php artisan migrate