awcodes/filament-sentry
最新稳定版本:v2.0.1
Composer 安装命令:
composer require awcodes/filament-sentry
包简介
A basic auth scaffolding for Filament utilizing Breezy, Shield and custom User Resources.
关键字:
README 文档
README
A basic auth scaffolding for Filament utilizing Filament Breezy, Filament Shield and custom User Resources.
Installation
Install the package via composer
composer require awcodes/filament-sentry
Publish config files.
This will publish Sentry's config and Sentry's version of Breezy's config with stronger default password rules. You are free to modify this however you see fit.
php artisan vendor:publish --tag=filament-sentry-config
Add the HasFilamentShield trait to your User model(s):
use Illuminate\Foundation\Auth\User as Authenticatable; use BezhanSalleh\FilamentShield\Traits\HasFilamentShield; class User extends Authenticatable { use HasFilamentShield; // or HasRoles // ... }
Install Shield
php artisan shield:install --fresh
Emailing new users with password reset link
Filament Sentry has the ability to email new users with a password reset link when they are created so they can make their password more accessible to them. This really should only be needed if you have disabled registration for your app.
This functionality can be turned on and off in the config file. Use the 'noreply' setting to set the email address that will be used as the sender of the email sent to new users.
'noreply' => 'example@example.com', 'email_new_users' => true
Unguarding Super Admin
Filament Sentry unguards users with the super_admin role allowing them to bypass policies and have full control over the system. If you do not want super_admins to have this priviledge you can disable it in the config.
'unguard_super_admin' => false,
Modifying the User Resource
To modify the User Resource you will need to eject the resource and pages into your app. This will publish the resource / pages to app/Filament/Resources and update the user_resource setting in Sentry's config file.
php artisan sentry:eject-resources
Note Any additional fields added to the user will need to be added to the $nonPermissionsFilter in both the CreateUser and EditUser resource pages.
// CreateUser.php protected function mutateFormDataBeforeCreate(array $data): array { $nonPermissionsFilter = ['name', 'email', 'password', 'bio', 'etc']; ... } // EditUser.php protected function mutateFormDataBeforeSave(array $data): array { $nonPermissionsFilter = ['name', 'email', 'password', 'bio', 'etc']; ... }
Seeder Reference (Optional)
In database/seeders/DatabaseSeeder.php or where appropriate:
use App\Models\User; use Spatie\Permission\Models\Role; use Illuminate\Support\Facades\Artisan; use Spatie\Permission\Models\Permission; $admin = Role::create(['name' => 'admin']) ->givePermissionTo(Permission::where('name', 'not like', '%_role')->get()); $editor = Role::create(['name' => 'editor']) ->givePermissionTo(Permission::where('name', 'not like', '%_role')->where('name', 'not like', '%_user')->get()); Artisan::call('shield:generate'); User::withoutEvents(function() { User::factory()->create([ 'name' => 'Tony Stark', 'email' => 'i.am@ironman.com', ])->assignRole('super_admin'); User::factory()->create([ 'name' => 'Pepper Pots', 'email' => 'pepper.pots@ironman.com', ])->assignRole('admin'); });
awcodes/filament-sentry 适用场景与选型建议
awcodes/filament-sentry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 261 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「laravel」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 awcodes/filament-sentry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 awcodes/filament-sentry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 awcodes/filament-sentry 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Alfabank REST API integration
Database-driven onboarding for Filament: progress checklists and guided spotlight tours, translatable to any locale.
High-performance, opinionated PHP 8 web framework with O(1) routing, parallel async MySQL, type-safe asset bridge, and React-island frontend
Laravel package for Accurate Online API integration.
The skeleton application for the Geoffrey agent framework.
统计信息
- 总下载量: 261
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-19