PHP code example of cube-agency / filament-tree-view

1. Go to this page and download the library: Download cube-agency/filament-tree-view 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/ */

    

cube-agency / filament-tree-view example snippets




namespace App\Models;

use CubeAgency\FilamentTreeView\Traits\HasTreeView;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Kalnoy\Nestedset\NodeTrait;

class ForumCategory extends Model
{
    use HasTreeView;
}

namespace App\Filament\Resources\ForumCategoryResource\Pages;

use App\Filament\Resources\ForumCategoryResource;
use CubeAgency\FilamentTreeView\Resources\Pages\TreeViewRecords;

class ListForumCategories extends TreeViewRecords
{
    protected static string $resource = ForumCategoryResource::class;
}

namespace App\Filament\Resources\ForumCategoryResource\Pages;

use App\Filament\Resources\ForumCategoryResource;
use CubeAgency\FilamentTreeView\Resources\Pages\CreateTreeViewRecord;

class CreateForumCategory extends CreateTreeViewRecord
{
    protected static string $resource = ForumCategoryResource::class;
}