Download the PHP package andrewdwallo/filament-companies without Composer
On this page you can find all versions of the php package andrewdwallo/filament-companies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andrewdwallo/filament-companies
More information about andrewdwallo/filament-companies
Files in andrewdwallo/filament-companies
Package filament-companies
Short Description A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.
License MIT
Homepage https://github.com/andrewdwallo/filament-companies
Informations about the package filament-companies
Filament Companies
A comprehensive multi-tenant authentication and authorization solution designed for Filament, with a focus on company-based tenancy.
- 🔥 Socialite
- 🔥 Terms & Privacy Policy
- 🔥 Password Reset via Email
- 🔥 Personal Profile Management
- 🔥 Browser Session Management
- 🔥 Sanctum
- 🔥 Company Management
- 🔥 Employee Invitations via Email
- 🔥 Roles & Permissions
Getting Started
- Create a fresh Laravel Project
- Configure your database
- Install the Panel Builder
After installing the Panel Builder, make sure that you have created a panel using the following command:
📝 If you've followed the Panel Builder documentation, you should have already done this.
Installation
Install the package
Execute the following Artisan command to scaffold the application. You will be prompted to choose between installing the Base package or enabling Socialite support.
Run migrations:
Preparing Your Application
Demo
If you encounter any issues while setting up your application with this package, you can refer to an example implementation here: Filament Companies Example App.
Creating a Theme
After installation, there will be a company panel registered for your application. It is located within the FilamentCompaniesServiceProvider.php
file.
In order for Tailwind to process the CSS used within this package and for the company panel, a user must create a custom theme.
To create a custom theme for the company panel, you can use the following command:
🛠️ Please follow the instructions in the console to complete the setup process
Here is a reference to the instructions that should show after running the command:
After completing the process for creating a custom theme for the company panel, add this package's vendor directory into the content array of the tailwind.config.js
file that should be located in the resources/css/filament/company/
directory of your application:
The User Panel
As 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.
For this example, I will use the default panel that Filament provides when installing the panel builder, the "Admin" panel.
In your "Admin" panel, make sure to register the following pages:
🛑 You may create a separate User Panel following the documentation for creating a new panel
You must provide a way for your users to navigate to the Profile and Personal Access Tokens pages.
It would also be wise to allow your users to navigate back to the Company Panel.
You may use the following as a guide:
You may change the value used for the User Panel using the id
of the panel:
🚧 Make sure to create a panel with the id you're passing
The Default Panel
If 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:
- Remove Default from User Panel: Ensure the User panel or any previously default panel does not use the
->default()
method. - Set Company Panel as Default: Apply the
->default()
method to your Company panel configuration to make it the default entry point.
By 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.
Translations and Views
If you wish to translate the package, you may publish the language files using:
If you wish to customize the views, you may publish them using:
Usage & Configuration
Switching the Current Company
Filament 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.
Configuring Profile Features
You can selectively enable or disable certain profile features. If you choose to omit a feature, it will be considered as disabled (false
) by default.
To do so, modify your FilamentCompaniesServiceProvider
class as shown below:
Customizing Components
Personalize 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.
Important: 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.
Here's an example of how to use a custom component for updating profile information:
Sorting Components
If you would like to change the order of the profile features, you may do so by setting the sort
parameter to the corresponding method.
The default sort order is as follows:
Adding Components
If 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:
Within your component's view, you may use the grid section component to match the style of other components:
Profile Photos
To allow users to upload custom profile photos, you can enable this feature by including the profilePhotos()
method in your FilamentCompaniesServiceProvider
.
Disk Storage
By default, the package uses Laravel's public
disk for storing images. However, you can specify a different disk by passing the disk
parameter.
Storage Path
If you want to store profile photos in a specific directory, you can set the storagePath
parameter.
Modals
To adjust the layout and behavior of modals, use the modals()
method. Below are the package's default settings:
Notifications
To configure the notifications that are sent by the package, use the notifications()
method.
Unless specified otherwise, the package will send notifications. In order to disable notifications, you must pass false
to the notifications()
method.
Overriding Notifications
To override the default notifications sent by the package, you should provide the following methods for each corresponding action.
The parameters passed to each method are optional and may be omitted if not needed.
Update User Profile Information
Update User Password
Set User Password
Update Company Name
Invite Company Employee
Delete Company
Example
If you would like to override the notification that is sent when a user updates their password, you may do the following:
Company Invitations
Example - Gmail
-
Sign in to your account
-
Go to App passwords
-
Click on "Select app", enter name of Application, and then click "Generate".
-
Copy your app password and store it somewhere safe.
- Add the credentials in your application's
.env
file:
Roles & Permissions
You may change the roles & permissions in app/Providers/FilamentCompaniesServiceProvider.php
Socialite
By Default, the GitHub Provider will be enabled.
You may use any Provider that Laravel Socialite supports.
You may add or remove any Provider in the company panel configuration:
⚠️ If Twitter is desired, you may only use either Twitter OAuth1 or Twitter OAuth2.
Pass your Provider's credentials in the provider's array in config/services.php
:
‼️ The Provider's Redirect URI must look similar to the above (e.g. 'APP_URL/company/oauth/provider/callback')
Example - GitHub
-
Register a new OAuth application
-
Application name
-
Homepage URL
-
Authorization callback URL
-
☑ Enable Device Flow
-
Click on Register application
-
Copy the Client Secret & store somewhere safe
- Add the Client ID and Client Secret in
.env
Methodology
- The following examples are a visual representation of the features this package supports that were provided by the methods implemented in Laravel Jetstream.
- You may find all of the features as provided by the package in the documentation.
- Information about a User's companies may be accessed via the methods provided by the
Wallo\FilamentCompanies\HasCompanies
trait. - This trait is automatically applied to your application's
App\Models\User
model during installation. - This trait provides a variety of helpful methods that allow you to inspect a User's companies or company:
📘 $user represents the current user of the application. Interchangeable with
Auth::user()
Credits
Notice
- If you have any questions please ask
- PR's and Issues are welcome
- If you have a general question and not an issue please ask in either my package's Discord Channel or make a discussion post.
Contributing
- Fork this repository to your GitHub account.
- Create a fresh Laravel & Filament Project.
- Clone your fork in your App's root directory.
- In the
/filament-companies
directory, create a branch for your fix, e.g.fix/error-message
.
Install the package in your application's composer.json
file, using the dev
prefix followed by your branch's name:
Now, run composer update
and continue by following the installation instructions above.
All versions of filament-companies with dependencies
ext-json Version *
filament/filament Version ^3.2.29
illuminate/console Version ^11.0
illuminate/contracts Version ^11.0
illuminate/support Version ^11.0
laravel/socialite Version ^5.12
matomo/device-detector Version ^6.1