mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-14 11:12:09 -05:00
- Fix CI workflow: actions/checkout@v6 → v4
- Install FilamentPHP ^5.0 and spatie/laravel-permission ^7.2
- Remove laravel/breeze from require-dev (replaced by Filament auth)
- Update User model: implements FilamentUser, HasTenants, HasRoles
- Publish Spatie permission migrations for role-based access
- Create Admin module with FilamentPHP panel at /admin
- UserResource, CategoryResource, ListingResource, LocationResource
- Role-based access (admin role required)
- Create Partner module with tenant-isolated panel at /partner/{id}
- ListingResource scoped to authenticated user
- Update modules_statuses.json: add Admin and Partner modules
- Update DatabaseSeeder: create admin/partner users with roles
- Improve seeders: LocationSeeder (10 countries), CategorySeeder (8 categories with children), ListingSeeder (10 sample listings)
- Add Docker support: Dockerfile, docker-compose.yml, docker-compose.dev.yml
- Add GitHub Codespaces: .devcontainer/devcontainer.json
- Update .env.example with Filament-relevant settings
- Update README.md with full documentation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
38 lines
2.0 KiB
PHP
38 lines
2.0 KiB
PHP
<?php
|
|
namespace Modules\Category\Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Modules\Category\Models\Category;
|
|
|
|
class CategorySeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$categories = [
|
|
['name' => 'Electronics', 'slug' => 'electronics', 'icon' => 'laptop', 'children' => ['Phones', 'Computers', 'Tablets', 'TVs']],
|
|
['name' => 'Vehicles', 'slug' => 'vehicles', 'icon' => 'car', 'children' => ['Cars', 'Motorcycles', 'Trucks', 'Boats']],
|
|
['name' => 'Real Estate', 'slug' => 'real-estate', 'icon' => 'home', 'children' => ['For Sale', 'For Rent', 'Commercial']],
|
|
['name' => 'Fashion', 'slug' => 'fashion', 'icon' => 'shirt', 'children' => ['Men', 'Women', 'Kids', 'Shoes']],
|
|
['name' => 'Home & Garden', 'slug' => 'home-garden', 'icon' => 'sofa', 'children' => ['Furniture', 'Garden', 'Appliances']],
|
|
['name' => 'Sports', 'slug' => 'sports', 'icon' => 'football', 'children' => ['Outdoor', 'Fitness', 'Team Sports']],
|
|
['name' => 'Jobs', 'slug' => 'jobs', 'icon' => 'briefcase', 'children' => ['Full Time', 'Part Time', 'Freelance']],
|
|
['name' => 'Services', 'slug' => 'services', 'icon' => 'wrench', 'children' => ['Cleaning', 'Repair', 'Education']],
|
|
];
|
|
|
|
foreach ($categories as $index => $data) {
|
|
$parent = Category::firstOrCreate(
|
|
['slug' => $data['slug']],
|
|
['name' => $data['name'], 'slug' => $data['slug'], 'icon' => $data['icon'], 'level' => 0, 'sort_order' => $index, 'is_active' => true]
|
|
);
|
|
|
|
foreach ($data['children'] as $i => $childName) {
|
|
$childSlug = $data['slug'] . '-' . \Illuminate\Support\Str::slug($childName);
|
|
Category::firstOrCreate(
|
|
['slug' => $childSlug],
|
|
['name' => $childName, 'slug' => $childSlug, 'parent_id' => $parent->id, 'level' => 1, 'sort_order' => $i, 'is_active' => true]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|