{"id":36979201,"url":"https://github.com/whilesmartphp/eloquent-organizations","last_synced_at":"2026-01-13T22:48:47.899Z","repository":{"id":311288713,"uuid":"1035191667","full_name":"whilesmartphp/eloquent-organizations","owner":"whilesmartphp","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-02T10:13:57.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2025-10-24T04:05:50.268Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whilesmartphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-09T21:12:21.000Z","updated_at":"2025-10-02T10:11:48.000Z","dependencies_parsed_at":"2025-09-26T17:32:30.349Z","dependency_job_id":"46cedf87-5bcb-45a0-9d78-974e2214612f","html_url":"https://github.com/whilesmartphp/eloquent-organizations","commit_stats":null,"previous_names":["whilesmartphp/eloquent-organizations"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/whilesmartphp/eloquent-organizations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-organizations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-organizations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-organizations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-organizations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whilesmartphp","download_url":"https://codeload.github.com/whilesmartphp/eloquent-organizations/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-organizations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-13T22:48:47.787Z","updated_at":"2026-01-13T22:48:47.891Z","avatar_url":"https://github.com/whilesmartphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Whilesmart Eloquent Organizations\n\nOrganization management package for Laravel applications with role-based access control and workspace integration.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/whilesmart/eloquent-organizations.svg?style=flat-square)](https://packagist.org/packages/whilesmart/eloquent-organizations)\n\n## Features\n\n- **Organization Management**: Complete CRUD operations for organizations\n- **Role Integration**: Built-in support for role-based access control\n- **Workspace Scoping**: Optional workspace-level organization isolation\n- **Polymorphic Ownership**: Organizations can be owned by any model (User, Team, etc.)\n- **API Ready**: Pre-built RESTful API endpoints\n- **Laravel Auto-Discovery**: Automatically registers service provider\n- **Flexible Configuration**: Customizable settings and behavior\n\n## Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require whilesmart/eloquent-organizations\n```\n\nThe package will automatically register its service provider.\n\n### Publish Configuration\n\nOptionally publish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=\"organizations-config\"\n```\n\n### Publish Routes\n\nTo customize the API routes:\n\n```bash\nphp artisan vendor:publish --tag=\"organizations-routes\"\n```\n\n## Usage\n\n### Organization Model\n\nThe package provides a complete `Organization` model with the following attributes:\n\n- **name**: Organization name\n- **slug**: URL-friendly identifier (auto-generated)\n- **type**: Organization type (company, nonprofit, etc.)\n- **email**: Contact email\n- **phone**: Contact phone number\n- **address**: Physical address\n- **website**: Website URL\n- **description**: Organization description\n- **owner**: Polymorphic relationship to owning model\n- **is_active**: Active status\n\n### API Endpoints\n\nThe package automatically registers these routes under `/api/organizations`:\n\n```\nGET    /api/organizations              # List organizations\nPOST   /api/organizations              # Create organization\nGET    /api/organizations/{id}         # Show organization\nPUT    /api/organizations/{id}         # Update organization\nDELETE /api/organizations/{id}         # Delete organization\n```\n\n### Workspace Integration\n\nWhen workspace scoping is enabled, organizations are automatically filtered by workspace:\n\n```\nGET    /api/workspaces/{id}/organizations    # Workspace-scoped organizations\nPOST   /api/workspaces/{id}/organizations    # Create in workspace\n```\n\n### Using in Your Models\n\n```php\nuse Illuminate\\Database\\Eloquent\\Relations\\BelongsTo;\nuse Whilesmart\\Organizations\\Models\\Organization;\n\nclass Project extends Model\n{\n    public function organization(): BelongsTo\n    {\n        return $this-\u003ebelongsTo(Organization::class);\n    }\n}\n```\n\n### Creating Organizations\n\n```php\nuse Whilesmart\\Organizations\\Models\\Organization;\n\n$organization = Organization::create([\n    'name' =\u003e 'Acme Corporation',\n    'type' =\u003e 'company',\n    'email' =\u003e 'contact@acme.com',\n    'website' =\u003e 'https://acme.com',\n    'owner_type' =\u003e 'App\\Models\\User',\n    'owner_id' =\u003e $user-\u003eid,\n    'is_active' =\u003e true,\n]);\n```\n\n### Role-Based Access Control\n\nThe package integrates with `whilesmart/eloquent-roles` for permission management:\n\n```php\n// Check if user can manage organizations\n$user-\u003ehasPermission('manage-organizations');\n\n// Check within specific workspace context\n$user-\u003ehasPermission('manage-organizations', 'workspace', $workspaceId);\n```\n\n## Configuration\n\nThe default configuration includes:\n\n```php\nreturn [\n    'workspace_scoped' =\u003e true,  // Enable workspace-level scoping\n    'require_owner' =\u003e true,     // Organizations must have an owner\n    'auto_slug' =\u003e true,         // Auto-generate slugs from names\n];\n```\n\n## Requirements\n\n- PHP ^8.2\n- Laravel ^11.0|^12.0\n- whilesmart/eloquent-roles ^1.0\n\n## Suggested Packages\n\n- **whilesmart/eloquent-workspaces**: For workspace integration support\n\n## License\n\nThe MIT License (MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhilesmartphp%2Feloquent-organizations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhilesmartphp%2Feloquent-organizations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhilesmartphp%2Feloquent-organizations/lists"}