atif/laravel-role-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

atif/laravel-role-manager

Composer 安装命令:

composer require atif/laravel-role-manager

包简介

A Laravel package for managing roles and permissions with full CRUD and UI.

README 文档

README

A premium, production-ready Laravel package for managing roles and permissions with a beautiful Tailwind CSS & Alpine.js powered UI. Built on top of the industry-standard spatie/laravel-permission package.

Package UI (Optional: Add your screenshot here)

Features

  • Professional UI: Built with advanced Tailwind CSS (glassmorphism, transitions) and Alpine.js.
  • Modal-Based Workflow: Create and edit roles/permissions without page reloads.
  • Real-time Feedback: Global toast notifications for CRUD operations.
  • Service Layer Architecture: Clean, maintainable code following Laravel best practices.
  • Advanced Role Assignment: Easily assign multiple permissions to roles directly from the UI.
  • Form Request Validation: Robust backend validation for all inputs.

Prerequisites

  • PHP ^8.2
  • Laravel ^10.0 or ^11.0 or ^12.0
  • Tailwind CSS (for the UI to render correctly)
  • Alpine.js (for modals and toasts)

Installation

1. Install the Package

Install the package via composer:

composer require atif/laravel-role-manager

2. Publish Assets

Publish the configuration, migrations, and views:

php artisan vendor:publish --provider="Atif\RoleManager\RoleManagerServiceProvider"

3. Run Migrations

Run the migrations to create the necessary tables:

php artisan migrate

Setup

1. Add the Trait to your User Model

Include the HasRoles trait in your App\Models\User model:

use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;
    // ...
}

2. Configure Tailwind CSS

Ensure your tailwind.config.js includes the package views so the styles are generated:

/** @type {import('tailwindcss').Config} */
export default {
  content: [
    "./resources/**/*.blade.php",
    "./resources/**/*.js",
    "./resources/**/*.vue",
    "./vendor/atif/laravel-role-manager/resources/views/**/*.blade.php", // Add this line
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

Usage

Accessing the Dashboard

Once installed, you can access the management interface at:

  • Roles: /roles
  • Permissions: /permissions

Middleware Protection

By default, the routes are open. You should protect them in your App\Providers\RouteServiceProvider or by wrapping them in your own route group with middleware:

Route::middleware(['auth', 'role:admin'])->group(function () {
    // Your role/permission routes are already registered, 
    // but you can control access via Spatie's middleware.
});

Configuration

You can customize the package behavior in config/RoleManager.php:

  • layout: The base layout your views should extend (default: layouts.app).
  • middleware: Global middleware for the package routes.
  • prefix: URL prefix for the routes.

Credits

License

The MIT License (MIT). Please see License File for more information.

atif/laravel-role-manager 适用场景与选型建议

atif/laravel-role-manager 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 atif/laravel-role-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 atif/laravel-role-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 atif/laravel-role-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-28