PHP code example of wsmallnews / category
1. Go to this page and download the library: Download wsmallnews/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/ */
wsmallnews / category example snippets
return [
'scopeable' => [
'scope_type' => 'sn-category',
'scope_id' => 0,
],
'models' => [
'category' => Wsmallnews\Category\Models\Category::class,
'category_type' => Wsmallnews\Category\Models\CategoryType::class,
],
'panel_register' => [
'pages' => [
Wsmallnews\Category\Filament\Pages\Category\CategoryPage::class,
],
'resources' => [
Wsmallnews\Category\Filament\Resources\CategoryTypes\CategoryTypeResource::class,
],
],
];
use Wsmallnews\Category\CategoryPlugin;
$panel
->plugin(CategoryPlugin::make());
namespace App\Filament\Pages;
use Wsmallnews\Category\Filament\Pages\Category\Base;
class ProductCategories extends Base
{
protected static ?string $slug = 'product-categories';
protected static ?string $scopeType = 'product';
protected static int $scopeId = 0;
protected static ?int $level = 3;
}
public function getScopeAttributes(): array
{
return ['scope_type', 'scope_id', 'type_id', 'team_id'];
}
bash
php artisan boost:update --discover
bash
php artisan sn-category:install
bash
php artisan sn-category:install --no-deps --no-interaction
bash
php artisan vendor:publish --tag="category-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="category-config"
bash
php artisan vendor:publish --tag="category-views"