{"id":13732955,"url":"https://github.com/andrewdwallo/filament-companies","last_synced_at":"2025-10-09T06:53:27.158Z","repository":{"id":65034581,"uuid":"579537041","full_name":"andrewdwallo/filament-companies","owner":"andrewdwallo","description":"A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.","archived":false,"fork":false,"pushed_at":"2025-08-22T23:43:16.000Z","size":899,"stargazers_count":338,"open_issues_count":5,"forks_count":70,"subscribers_count":8,"default_branch":"5.x","last_synced_at":"2025-10-02T00:33:07.142Z","etag":null,"topics":["authentication","authorization","filament","laravel","management","multitenancy","socialite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewdwallo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-12-18T02:26:37.000Z","updated_at":"2025-09-22T14:58:58.000Z","dependencies_parsed_at":"2023-02-12T12:15:59.708Z","dependency_job_id":"e415e16b-c5db-4524-84ff-98592701ca27","html_url":"https://github.com/andrewdwallo/filament-companies","commit_stats":{"total_commits":278,"total_committers":17,"mean_commits":"16.352941176470587","dds":0.3597122302158273,"last_synced_commit":"049b98c271bbf26ac004ca523b246e7d263ddacb"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/andrewdwallo/filament-companies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewdwallo%2Ffilament-companies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewdwallo%2Ffilament-companies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewdwallo%2Ffilament-companies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewdwallo%2Ffilament-companies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewdwallo","download_url":"https://codeload.github.com/andrewdwallo/filament-companies/tar.gz/refs/heads/5.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewdwallo%2Ffilament-companies/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278354451,"owners_count":25973359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["authentication","authorization","filament","laravel","management","multitenancy","socialite"],"created_at":"2024-08-03T03:00:35.952Z","updated_at":"2025-10-09T06:53:27.149Z","avatar_url":"https://github.com/andrewdwallo.png","language":"PHP","funding_links":[],"categories":["Complete App","Complete Sections"],"sub_categories":[],"readme":"![gif (1)](https://user-images.githubusercontent.com/104294090/221399175-add7c34b-4887-49b7-9061-6781f6391409.gif)\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://filamentphp.com\"\u003e\n        \u003cimg alt=\"FILAMENT 4.x\" src=\"https://img.shields.io/badge/FILAMENT-4.x-EBB304?style=for-the-badge\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/andrewdwallo/filament-companies\"\u003e\n        \u003cimg alt=\"Packagist\" src=\"https://img.shields.io/packagist/v/andrewdwallo/filament-companies.svg?style=for-the-badge\u0026logo=packagist\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/andrewdwallo/filament-companies/stats\"\u003e\n        \u003cimg alt=\"Downloads\" src=\"https://img.shields.io/packagist/dt/andrewdwallo/filament-companies?style=for-the-badge\u0026logo=packagist\u0026logoColor=red\u0026color=red\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr style=\"background-color: #ebb304\"\u003e\n\n# Filament Companies\n\nA comprehensive multi-tenant authentication and authorization solution designed for Filament, with a focus on company-based tenancy.\n\n- 🔥 **Socialite**\n- 🔥 **Terms \u0026 Privacy Policy**\n- 🔥 **Password Reset via Email**\n- 🔥 **Personal Profile Management**\n- 🔥 **Browser Session Management**\n- 🔥 **Sanctum**\n- 🔥 **Company Management**\n- 🔥 **Employee Invitations via Email**\n- 🔥 **Roles \u0026 Permissions**\n- 🔥 **Auto-Accept Invitations**\n\n# Getting Started\n\n* Create a fresh Laravel Project\n* Configure your database\n* Install the [Panel Builder](https://filamentphp.com/docs/4.x/introduction/installation#installing-the-panel-builder)\n\nAfter installing the Panel Builder, ensure you create a panel using the following command:\n```shell\nphp artisan filament:install --panels\n```\n\u003e 📝 If you've followed the Panel Builder documentation, you should have already done this.\n\n# Installation\n\nInstall the package\n```shell\ncomposer require andrewdwallo/filament-companies\n```\n\nExecute the following Artisan command to scaffold the application. You will be prompted to choose between installing the **Base package** or enabling **Socialite** support.\n\n```shell\nphp artisan filament-companies:install\n```\n\nRun migrations:\n```shell\nphp artisan migrate:fresh\n```\n\n# Preparing Your Application\n\n### Demo\n\nIf you encounter any issues while setting up your application with this package, refer to the example implementation here: [Filament Companies Example App](https://github.com/andrewdwallo/filament-companies-example-app).\n\n### Creating a Theme\n\nAfter installation, there will be a company panel registered for your application. It is located within the `FilamentCompaniesServiceProvider.php` file.\n\nIn order for Tailwind to process the CSS used within this package and for the company panel, a user must [create a custom theme](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme).\n\nOnce the custom theme for the company panel is created, add this package's vendor directory to your `resources/css/filament/company/theme.css` file:\n\n```css\n@source '../../../../vendor/andrewdwallo/filament-companies/resources/views';\n```\n\n### The User Panel\n\nAs you may have noticed, after installation, there will be a company panel registered for your application. In order for this package to work you must also have a \"User\" panel to contain the Profile page and Personal Access Tokens page.\n\nFor this example, I will use the default panel that Filament provides when installing the panel builder, the \"Admin\" panel.\n\nIn your \"Admin\" panel, make sure to register the following pages:\n```php\nuse Wallo\\FilamentCompanies\\Pages\\User\\PersonalAccessTokens;\nuse Wallo\\FilamentCompanies\\Pages\\User\\Profile;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        // ...\n        -\u003epages([\n            Profile::class,\n            PersonalAccessTokens::class,\n        ])\n}\n```\n\u003e 🛑 You may create a separate User Panel following the documentation for [creating a new panel](https://filamentphp.com/docs/4.x/panel-configuration#creating-a-new-panel)\n\nEnsure users have a way to navigate to the Profile and Personal Access Tokens pages.\n\nUsers should also have a way to navigate back to the Company Panel.\n\nYou may use the following as a guide:\n```php\nuse Filament\\Navigation\\MenuItem;\nuse Filament\\Navigation\\NavigationItem;\nuse Illuminate\\Support\\Facades\\Auth;\nuse Wallo\\FilamentCompanies\\Pages\\User\\PersonalAccessTokens;\nuse Wallo\\FilamentCompanies\\Pages\\User\\Profile;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        // ...\n        -\u003euserMenuItems([\n            'profile' =\u003e MenuItem::make()\n                -\u003elabel('Profile')\n                -\u003eicon('heroicon-o-user-circle')\n                -\u003eurl(static fn () =\u003e Profile::getUrl()),\n            MenuItem::make()\n                -\u003elabel('Company')\n                -\u003eicon('heroicon-o-building-office')\n                -\u003eurl(static fn () =\u003e Pages\\Dashboard::getUrl(panel: FilamentCompanies::getCompanyPanel(), tenant: Auth::user()-\u003epersonalCompany())),\n        ])\n        -\u003enavigationItems([\n            NavigationItem::make('Personal Access Tokens')\n                -\u003elabel(static fn (): string =\u003e __('filament-companies::default.navigation.links.tokens'))\n                -\u003eicon('heroicon-o-key')\n                -\u003eurl(static fn () =\u003e PersonalAccessTokens::getUrl()),\n        ])\n}\n```\n\nIf [**Auto-Accept Invitations**](#auto-accept-invitations) is enabled, the Company menu item logic must handle cases where the user does not have a personal company to avoid errors. One way to do this is as follows:\n```php\nMenuItem::make()\n    -\u003elabel('Company')\n    -\u003eicon('heroicon-o-building-office')\n    -\u003eurl(static function (): ?string {\n        $user = Auth::user();\n\n        if ($company = $user?-\u003eprimaryCompany()) {\n            return Pages\\Dashboard::getUrl(panel: FilamentCompanies::getCompanyPanel(), tenant: $company);\n        }\n\n        return Filament::getPanel(FilamentCompanies::getCompanyPanel())-\u003egetTenantRegistrationUrl();\n    }),\n```\n\u003e [!NOTE]\n\u003e This modification is necessary because, when Auto-Accept Invitations is enabled, an invited user may not have a personal company. Without this adjustment, generating a URL with a `null` tenant may cause an error.\n\nYou may change the value used for the User Panel using the `id` of the panel:\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003euserPanel('user')\n            )\n    }\n}\n```\n\u003e 🚧 Make sure to create a panel with the id you're passing\n\n### The Default Panel\n\nIf you want users to directly access the Company panel's Register or Login page from the Laravel Welcome page, ensure the Company panel is set as the default in Filament. This involves two key steps:\n\n1. Remove Default from User Panel: Ensure the User panel or any previously default panel does not use the `-\u003edefault()` method. \n2. Set Company Panel as Default: Apply the `-\u003edefault()` method to your Company panel configuration to make it the default entry point.\n\nBy making the Company panel the default, links to Register or Login on the Laravel Welcome page will lead directly to the Company panel's authentication pages.\n\n### Translations and Views\n\nIf you wish to translate the package, you may publish the language files using:\n```shell\nphp artisan vendor:publish --tag=filament-companies-translations\n```\n\nIf you wish to customize the views, you may publish them using:\n```shell\nphp artisan vendor:publish --tag=filament-companies-views\n```\n\n### Email Verification\n\nIf you are using [email verification](https://filamentphp.com/docs/4.x/users/overview#authentication-features) make sure to register your verify-email url. If this is not properly registerd, you may see errors on the user profile page. You can either add this via Filament's `VerifyEmail` facade or a new route in your app.\n\n#### Registering the URL via the create URL Notification callback\n\nPlace this in your `AppServiceProvider`'s boot method:\n\n```php\nuse Filament\\Facades\\Filament;\nuse Filament\\Notifications\\Auth\\VerifyEmail;\n\n// Verify email notification url\nVerifyEmail::createUrlUsing(function ($notifiable) {\n    return Filament::getVerifyEmailUrl($notifiable);\n});\n```\n\n#### Registering your email verification route through a new route\n\nPlace this in routes file - typically `web.php`:\n\n```php\nuse Filament\\Http\\Controllers\\Auth\\EmailVerificationController;\n\nRoute::get('/email/verify/{id}/{hash}', [EmailVerificationController::class, '__invoke'])\n    -\u003emiddleware(['signed'])\n    -\u003ename('verification.verify');\n```\n\n# Usage \u0026 Configuration\n\n### Switching the Current Company\n\nFilament has a built-in event that is fired when the application needs to set the tenant for the current request. This event is `Filament\\Events\\TenantSet`. If you would like to either enable or disable the ability to switch the current company, you may do so by using the `switchCurrentCompany()` method in your `FilamentCompaniesServiceProvider` class.\n\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003eswitchCurrentCompany()\n            );\n    }\n}\n```\n\u003e [!CAUTION]\n\u003e This feature is a core part of the package and should typically remain enabled. Disabling it will prevent users from switching between companies, which may not be desirable for most use cases.\n\n## Configuring Profile Features\n\nYou can selectively enable or disable certain profile features. If a feature is omitted, it will be disabled by default.\n\nTo do so, modify your `FilamentCompaniesServiceProvider` class as shown below:\n\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003eupdateProfileInformation()  // Enables updating profile information\n                    -\u003eupdatePasswords()           // Enables password updates\n                    -\u003esetPasswords()              // Enables setting passwords only if Socialite is enabled\n                    -\u003econnectedAccounts()         // Enables connected account management only if Socialite is enabled\n                    -\u003emanageBrowserSessions()     // Enables browser session management\n                    -\u003eaccountDeletion()           // Enables account deletion\n            );\n    }\n}\n```\n\n### Customizing Components\n\nPersonalize your application by replacing default components with your own custom components. This is done by passing your custom component's class name to the component parameter of the relevant method.\n\n\u003e [!IMPORTANT]\n\u003e Your custom component must have a unique class name. This is crucial to prevent conflicts and ensure proper functioning, as Livewire differentiates components primarily by their class names. Even if your custom component is in a different namespace, having the same class name as a component in the package can lead to unexpected errors and behavior.\n\nHere's an example of how to use a custom component for updating profile information:\n\n```php\nuse App\\Livewire\\CustomComponent;\n\nFilamentCompanies::make()\n    -\u003eupdateProfileInformation(component: CustomComponent::class);\n```\n\n### Sorting Components\n\nIf you would like to change the order of the profile features, you may do so by setting the `sort` parameter to the corresponding method. \n\nThe default sort order is as follows:\n\n```php\nFilamentCompanies::make()\n    -\u003eupdateProfileInformation(sort: 0)\n    -\u003eupdatePasswords(sort: 1)\n    -\u003esetPasswords(sort: 2)\n    -\u003econnectedAccounts(sort: 3)\n    -\u003emanageBrowserSessions(sort: 4)\n    -\u003eaccountDeletion(sort: 5);\n```\n\n### Adding Components\n\nIf you would like to add custom profile components, you may do so by passing the component class name along with the sort order to the `addProfileComponents()` method:\n\n```php\nuse App\\Livewire\\CustomComponent;\n\nFilamentCompanies::make()\n    -\u003eaddProfileComponents([\n        7 =\u003e CustomComponent::class,\n    ]);\n```\n\nWithin your component's view, you may use the grid section component to match the style of other components:\n\n```blade\n\u003cx-filament-companies::grid-section md=\"2\"\u003e\n    \u003cx-slot name=\"title\"\u003e\n        {{ __('My Custom Component') }}\n    \u003c/x-slot\u003e\n\n    \u003cx-slot name=\"description\"\u003e\n        {{ __('This is my custom component.') }}\n    \u003c/x-slot\u003e\n\n    \u003cx-filament::section\u003e\n        \u003cx-filament-panels::form wire:submit=\"submit\"\u003e\n            {{ $this-\u003eform }}\n\n            \u003cdiv class=\"text-left\"\u003e\n                \u003cx-filament::button type=\"submit\"\u003e\n                    {{ __('Save') }}\n                \u003c/x-filament::button\u003e\n            \u003c/div\u003e\n        \u003c/x-filament-panels::form\u003e\n    \u003c/x-filament::section\u003e\n\u003c/x-filament-companies::grid-section\u003e\n```\n\n## Configuring Company Settings Features\n\nSimilar to profile features, you can customize the company settings page by enabling specific features and customizing their components.\n\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003eupdateCompanyInformation()   // Enables updating company names\n                    -\u003emanageCompanyEmployees()     // Enables company employee management\n                    -\u003ecompanyDeletion()            // Enables company deletion\n            );\n    }\n}\n```\n\n### Customizing Company Settings Components\n\nYou can replace default company settings components with your own custom components:\n\n```php\nuse App\\Livewire\\CustomCompanyComponent;\n\nFilamentCompanies::make()\n    -\u003eupdateCompanyInformation(component: CustomCompanyComponent::class);\n```\n\n### Sorting Company Settings Components\n\nChange the order of company settings features by setting the `sort` parameter:\n\n```php\nFilamentCompanies::make()\n    -\u003eupdateCompanyInformation(sort: 0)\n    -\u003emanageCompanyEmployees(sort: 1)\n    -\u003ecompanyDeletion(sort: 2);\n```\n\n### Adding Company Settings Components\n\nIf you would like to add custom company settings components, you may do so by passing the component class name along with the sort order to the `addCompanyComponents()` method:\n\n```php\nuse App\\Livewire\\CustomCompanyComponent;\n\nFilamentCompanies::make()\n    -\u003eaddCompanyComponents([\n        5 =\u003e CustomCompanyComponent::class,\n    ]);\n```\n\n## Profile Photos\n\nTo allow users to upload custom profile photos, you can enable this feature by including the `profilePhotos()` method in your `FilamentCompaniesServiceProvider`.\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003eprofilePhotos()\n            )\n    }\n}\n```\n\n### Disk Storage\n\nBy default, the package uses Laravel's `public` disk for storing images. However, you can specify a different disk by passing the `disk` parameter.\n```php\nFilamentCompanies::make()\n    -\u003eprofilePhotos(disk: 's3')\n```\n\n### Storage Path\n\nIf you want to store profile photos in a specific directory, you can set the `storagePath` parameter.\n```php\nFilamentCompanies::make()\n    -\u003eprofilePhotos(storagePath: 'profile-avatars')\n```\n\n## Modals\n\nTo adjust the layout and behavior of modals, use the `modals()` method. Below are the package's default settings:\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003emodals(\n                        width: '2xl', \n                        alignment: 'center', \n                        formActionsAlignment: 'center', \n                        cancelButtonAction: false\n                    )\n            );\n    }\n}\n```\n\n## Notifications\n\nTo configure the notifications that are sent by the package, use the `notifications()` method.\n\nUnless specified otherwise, the package will send notifications. In order to disable notifications, you must pass `false` to the `notifications()` method.\n\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003enotifications(condition: false)\n            );\n    }\n}\n```\n\n### Overriding Notifications\n\nTo override the default notifications sent by the package, you should provide the following methods for each corresponding action.\n\nThe parameters passed to each method are optional and may be omitted if not needed.\n\n#### Update User Profile Information\n\n```php\n\\App\\Actions\\FilamentCompanies\\UpdateUserProfileInformation::class\n\n/** @method void profileInformationUpdated(\\Illuminate\\Foundation\\Auth\\User|null $user = null, array|null $input = null) */\n```\n\n#### Update User Password\n\n```php\n\\App\\Actions\\FilamentCompanies\\UpdateUserPassword::class\n\n/** @method void passwordUpdated(\\Illuminate\\Foundation\\Auth\\User|null $user = null, array|null $input = null) */\n```\n\n#### Set User Password\n\n```php\n\\App\\Actions\\FilamentCompanies\\SetUserPassword::class\n\n/** @method void passwordSet(\\Illuminate\\Foundation\\Auth\\User|null $user, array|null $input = null) */\n```\n\n#### Update Company Name\n\n```php\n\\App\\Actions\\FilamentCompanies\\UpdateCompanyName::class\n\n/** @method void companyNameUpdated(\\Illuminate\\Foundation\\Auth\\User|null $user = null, \\Illuminate\\Database\\Eloquent\\Model|null $company = null, array|null $input = null) */\n```\n\n#### Invite Company Employee\n\n```php\n\\App\\Actions\\FilamentCompanies\\InviteCompanyEmployee::class\n\n/** @method void employeeInvitationSent(\\Illuminate\\Foundation\\Auth\\User|null $user = null, \\Illuminate\\Database\\Eloquent\\Model|null $company = null, string|null $email = null, string|null $role = null) */\n```\n\n#### Delete Company\n\n```php\n\\App\\Actions\\FilamentCompanies\\DeleteCompany::class\n\n/** @method void companyDeleted(\\Illuminate\\Database\\Eloquent\\Model|null $company = null) */\n```\n\n#### Example\n\nIf you would like to override the notification that is sent when a user updates their password, you may do the following:\n```php\n\u003c?php\n\nnamespace App\\Actions\\FilamentCompanies;\n\nuse App\\Models\\User;\nuse Filament\\Notifications\\Notification;\nuse Wallo\\FilamentCompanies\\Contracts\\UpdatesUserPasswords;\n\nclass UpdateUserPassword implements UpdatesUserPasswords\n{\n    /**\n     * Validate and update the user's password.\n     *\n     * @param  array\u003cstring, string\u003e  $input\n     */\n    public function update(User $user, array $input): void\n    {\n       // ...\n    }\n\n    public function passwordUpdated(): void\n    {\n        Notification::make()\n            -\u003etitle('Password Updated')\n            -\u003ebody('Your password has been updated.')\n            -\u003esuccess();\n            -\u003esend();\n    }\n    \n}\n```\n\n## Company Invitations\n\n### Auto-Accept Invitations\n\nThis feature allows invited users to bypass the personal company creation step during registration and be redirected to accept their company invitation immediately. This ensures a smoother onboarding process for employees or team members joining an existing company. \n\nIf disabled, users must create a personal company during registration if they don’t already have one.\n\nTo enable this, configure your `FilamentCompaniesServiceProvider`:\n```php\nFilamentCompanies::make()\n    -\u003ecompanies(invitations: true)\n    -\u003eautoAcceptInvitations()\n```\n\nWhen enabled, invited users can register and directly join their invited company without unnecessary setup steps.\n\n### Example - Send Invitation Mail via Gmail SMTP\n\n1. **Sign in** to your account\n\n2. **Go** to [App passwords](https://myaccount.google.com/apppasswords)\n\n3. **Click** on \"Select app\", enter name of Application, and then click \"Generate\".\n\n4. **Copy** your app password and store it somewhere safe.\n\n6. **Add** the credentials in your application's `.env` file:\n```dotenv\nMAIL_MAILER=smtp\nMAIL_HOST=smtp.gmail.com\nMAIL_PORT=587\nMAIL_USERNAME=\u003cYOUR_GMAIL_EMAIL\u003e\nMAIL_PASSWORD=\u003cYOUR_GMAIL_APP_PASSWORD\u003e  \nMAIL_ENCRYPTION=tls                    \nMAIL_FROM_ADDRESS=\u003cYOUR_GMAIL_EMAIL\u003e\nMAIL_FROM_NAME=\"${APP_NAME}\"\n```\n\n## Roles \u0026 Permissions\n\nYou may change the roles \u0026 permissions in `app/Providers/FilamentCompaniesServiceProvider.php`\n```php\n/**\n * Configure the roles and permissions that are available within the application.\n */\nprotected function configurePermissions(): void\n{\n    FilamentCompanies::defaultApiTokenPermissions(['read']);\n\n    FilamentCompanies::role('admin', 'Administrator', [\n        'create',\n        'read',\n        'update',\n        'delete',\n    ])-\u003edescription('Administrator users can perform any action.');\n\n    FilamentCompanies::role('editor', 'Editor', [\n        'read',\n        'create',\n        'update',\n    ])-\u003edescription('Editor users have the ability to read, create, and update.');\n}\n```\n\n## Socialite\n\nBy Default, the GitHub Provider will be enabled.\n\nYou may use any Provider that [Laravel Socialite](https://laravel.com/docs/10.x/socialite/) supports.\n\nYou may add or remove any Provider in the company panel configuration:\n```php\nuse Filament\\Panel;\nuse Wallo\\FilamentCompanies\\FilamentCompanies;\nuse Wallo\\FilamentCompanies\\Enums\\Feature;\nuse Wallo\\FilamentCompanies\\Enums\\Provider;\n\nclass FilamentCompaniesServiceProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            // ...\n            -\u003eplugin(\n                FilamentCompanies::make()\n                    -\u003esocialite(\n                        providers: [\n                            Provider::Github,\n                            Provider::Gitlab,\n                            Provider::Google,\n                            Provider::Facebook,\n                            Provider::Linkedin,\n                            Provider::LinkedinOpenId,\n                            Provider::Bitbucket,\n                            Provider::Slack,\n                            Provider::Twitter,\n                            Provider::TwitterOAuth2,\n                        ],\n                        features: [\n                            Feature::RememberSession,\n                            Feature::ProviderAvatars,\n                            Feature::GenerateMissingEmails,\n                            Feature::LoginOnRegistration,\n                            Feature::CreateAccountOnFirstLogin,\n                        ]\n                    )\n            )\n    }\n}\n```\n\u003e ⚠️ If Twitter is desired, you may only use either Twitter OAuth1 or Twitter OAuth2. \n\nPass your Provider's credentials in the provider's array in `config/services.php`:\n```php\n    /*\n    |--------------------------------------------------------------------------\n    | Third Party Services\n    |--------------------------------------------------------------------------\n    |\n    | This file is for storing the credentials for third party services such\n    | as Mailgun, Postmark, AWS and more. This file provides the de facto\n    | location for this type of information, allowing packages to have\n    | a conventional file to locate the various service credentials.\n    |\n    */\n    \n    'github' =\u003e [\n        'client_id' =\u003e env('GITHUB_CLIENT_ID'),\n        'client_secret' =\u003e env('GITHUB_CLIENT_SECRET'),\n        'redirect' =\u003e 'https://filament.test/company/oauth/github/callback',\n    ],\n```\n\u003e ‼️ The Provider's Redirect URI must look similar to the above (e.g. 'APP_URL/company/oauth/provider/callback')\n\n### Example - GitHub\n\n1. Register a [new OAuth application](https://github.com/settings/applications/new)\n\n2. Application name\n```\nFilament\n```\n\n3. Homepage URL\n```\nhttp://filament.test/company\n```\n\n4. Authorization callback URL\n```\nhttp://filament.test/company/oauth/github/callback\n```\n\n5. ☑ Enable Device Flow\n\n6. Click on **Register application**\n\n7. **Copy** the Client Secret \u0026 **store** somewhere safe\n\n8. **Add** the Client ID and Client Secret in `.env`\n```dotenv\nGITHUB_CLIENT_ID=\u003cYOUR_GITHUB_CLIENT_ID\u003e\nGITHUB_CLIENT_SECRET=\u003cYOUR_GITHUB_CLIENT_SECRET\u003e\n```\n\n## Methodology\n\n- The following examples illustrate features supported by this package, inspired by methods originally implemented in Laravel Jetstream.\n- Information about a user's companies can be accessed through methods provided by the `Wallo\\FilamentCompanies\\HasCompanies` trait.\n- This trait is automatically applied to your application's `App\\Models\\User` model during installation.\n\n```php\n// Access a user's currently selected company...\n$user-\u003ecurrentCompany : Wallo\\FilamentCompanies\\Company\n\n// Access all of the companies (including owned companies) that a user belongs to...\n$user-\u003eallCompanies() : Illuminate\\Support\\Collection\n\n// Access all of a user's owned companies...\n$user-\u003eownedCompanies : Illuminate\\Database\\Eloquent\\Collection\n\n// Access all of the companies that a user belongs to but does not own...\n$user-\u003ecompanies : Illuminate\\Database\\Eloquent\\Collection\n\n// Access a user's \"personal\" company...\n$user-\u003epersonalCompany() : Wallo\\FilamentCompanies\\Company\n\n// Get the user's primary company (prioritizes personal company)...\n$user-\u003eprimaryCompany() : Wallo\\FilamentCompanies\\Company|null\n\n// Determine if the user has any companies...\n$user-\u003ehasAnyCompanies() : bool\n\n// Determine if a user owns a given company...\n$user-\u003eownsCompany($company) : bool\n\n// Determine if a user belongs to a given company...\n$user-\u003ebelongsToCompany($company) : bool\n\n// Get the role that the user is assigned on the company...\n$user-\u003ecompanyRole($company) : \\Wallo\\FilamentCompanies\\Role\n\n// Determine if the user has the given role on the given company...\n$user-\u003ehasCompanyRole($company, 'admin') : bool\n\n// Access an array of all permissions a user has for a given company...\n$user-\u003ecompanyPermissions($company) : array\n\n// Determine if a user has a given company permission...\n$user-\u003ehasCompanyPermission($company, 'server:create') : bool\n```\n\u003e 📘 $user represents the current user of the application. Interchangeable with `Auth::user()`\n\n## Credits\n\n- [Laravel Jetstream](https://jetstream.laravel.com/introduction.html)\n- [Socialstream](https://docs.socialstream.dev/)\n\n## Notice\n* If you have any questions please ask\n* PR's and Issues are welcome\n* If you have a general question and not an issue please ask in either my package's [Discord Channel](https://discord.com/channels/883083792112300104/1059008724410310767) or make a discussion post.\n\n## Contributing\n* Fork this repository to your GitHub account.\n* Create a fresh Laravel \u0026 Filament Project.\n* Clone your fork in your App's root directory.\n* In the `/filament-companies` directory, create a branch for your fix, e.g. `fix/error-message`.\n\nInstall the package in your application's `composer.json` file, using the `dev` prefix followed by your branch's name:\n```json\n{\n    ...\n    \"require\": {\n        \"andrewdwallo/filament-companies\": \"dev-fix/error-message\",\n    },\n    \"repositories\": [\n        {\n            \"type\": \"path\",\n            \"url\": \"filament-companies/\"\n        }\n    ],\n    ...\n}\n```\n\nRun `composer update`, then follow the installation instructions above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewdwallo%2Ffilament-companies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewdwallo%2Ffilament-companies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewdwallo%2Ffilament-companies/lists"}