From 69729d0f00aa5eb17b26f851c24bee7f671f913c Mon Sep 17 00:00:00 2001 From: Dave Mills Date: Thu, 31 Oct 2024 15:40:59 +0000 Subject: [PATCH 1/2] Update README.md --- README.md | 68 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 9031560..b6582e7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -# Package for an opinionated 'teams' setup, including invites and integration with Laravel Filament + Spatie User Roles +# Filament Team Management [![Latest Version on Packagist](https://img.shields.io/packagist/v/stats4sd/filament-team-management.svg?style=flat-square)](https://packagist.org/packages/stats4sd/filament-team-management) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/stats4sd/filament-team-management/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/stats4sd/filament-team-management/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/stats4sd/filament-team-management/fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/stats4sd/filament-team-management/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/stats4sd/filament-team-management.svg?style=flat-square)](https://packagist.org/packages/stats4sd/filament-team-management) +Package for an opinionated 'teams' setup, including invites and integration with Laravel Filament + Spatie User Roles. -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. - ## Installation You can install the package via composer: @@ -17,49 +16,62 @@ You can install the package via composer: composer require stats4sd/filament-team-management ``` -This package requires Laravel Filament and this package: https://filamentphp.com/plugins/tharinda-rodrigo-spatie-roles-permissions to be installed. Make sure you follow the installation instructions for those packages first: +Then, run the provided installation script. -- https://filamentphp.com/plugins/tharinda-rodrigo-spatie-roles-permissions +```bash +php artisan filament-team-management:install +``` +The script will ask you if you want to use the concept of "programs" in your app. Based on your response, it will publish the appropriate migration files and update your .env file with the appropriate variables. It will also offer to add some example Database Seeders to your main `database/seeders/DatabaseSeeder.php` file. -You can publish and run the migrations with: -```bash -php artisan vendor:publish --tag="filament-team-management-migrations" -php artisan migrate -``` +## Features -You can publish the config file with: +This app provides a set of models, Filament Resources and Mail classes that lets you quickly setup a Filament-based application that uses Teams to manage users. -```bash -php artisan vendor:publish --tag="filament-team-management-config" -``` -Optionally, you can publish the views using +### Filament Resources -```bash -php artisan vendor:publish --tag="filament-team-management-views" -``` +The intention is that this package is used for apps where you have 2 different Filament Panels: -This is the contents of the published config file: +- An "Admin" panel, for administrators to manage users and teams. +- An "App" panel, which uses multitenancy with teams as the tennant. + +You can also optionally use 'programs', which are groups of teams. In this case, you may have a 3rd panel: + +- A "Program" panel, for program managers to manage the users and teams within their own program. + +The Resources in this package are intended for one of these 3 panels, shown by their namespacing within the package. You can add these Resource classes to any panel in your `PanelProvider` class: ```php -return [ -]; +$panel + ## add all resources in a namespace at once + ->discoverResources(in: app_path('../vendor/stats4sd/filament-team-management/src/Filament/Admin/Resources'), for: 'Stats4sd\\FilamentTeamManagement\\Admin\\Resources) + ## OR... add resources individually + ->resources([ + Stats4sd\\FilamentTeamManagement\\Admin\\Resources\\TeamResource, + ... +]) ``` -## Usage +### Invitations + +This package includes the needed setup to let your users invite other users via email. There are 3 different types of invite: + + - `RoleInvite`: The provided UserResource lets you invite users to join the platform with a specific role + - `Invite`: The provided TeamResource lets you invite users to join a specific team on the platform. + - `ProgramInvite`: If you use programs, the provided ProgramResource lets you invite users to join a specific program. + +To make the registration work, you **must** add the pages in the namespace `Stats4sd\\FilamentTeamManagement\\App\\Pages` to one of your Panels. Otherwise the registration pages will not be correctly registered in the app. + +For example: ```php -$filamentTeamManagement = new Stats4sd\FilamentTeamManagement(); -echo $filamentTeamManagement->echoPhrase('Hello, Stats4sd!'); +$panel +->discoverPages(in: app_path('../vendor/stats4sd/filament-team-management/src/Filament/App/Pages'), for: 'Stats4sd\\FilamentTeamManagement\\App\\Pages) ``` -## Testing -```bash -composer test -``` ## Changelog From ddcf48aa160139c67276205097713f0d86692d51 Mon Sep 17 00:00:00 2001 From: Dave Mills Date: Thu, 31 Oct 2024 15:42:26 +0000 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b6582e7..b96d908 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ php artisan filament-team-management:install The script will ask you if you want to use the concept of "programs" in your app. Based on your response, it will publish the appropriate migration files and update your .env file with the appropriate variables. It will also offer to add some example Database Seeders to your main `database/seeders/DatabaseSeeder.php` file. +For a full guide on how to set this package up with a brand new Laravel installation, see [SETUP.md](SETUP.md) + ## Features