hex-digital/admin-module

Module for providing core admin functionality to our Laravel projects.


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This module provides the core admin functionality for our Laravel projects. This module automatically takes care of installing and configuring Filament, managing admins and managing admin roles and permissions.

Installation

To get started with the admin module, you can install the pacakge via composer:

composer require hex-digital/admin-module

Next, you'll need to publish the config file, migrations and assets for the module and module dependencies. To simplfy this, the module comes with an install command:

php artisan admin-module:install

Every time you upgrade the module or Filament, you need to run the admim:module and filament:upgrade commands. We recommend adding this to your composer.json's post-update-cmd:

"post-update-cmd": [
    // ...
    "@php artisan filament:upgrade",
    "@php artisan admin-module:publish",
],

You should now run your migrations and sync the permissions:

php artisan migrate
php artisan permission:sync

Lastly, you can create a new admin account using:

php artisan make:filament-user

Visit your admin panel at /admin to sign in, and you're ready to start building.

Usage

Models & Resources

The admin module ships with an Admin which is used for authentication. You can override this model by setting the admin-module.admins.model config.

Under the hood, we use the Spatie Roles and Permissions package for authorization of admins. The admin module exposes a resource for managing both admins and roles.

You can customise these models / resources by editing the config.

Permissions

The admin module exposes a permission:sync commandwhich allows you to sync permissions which can then be assigned to roles. By default, the module provides permissions for managing admins and roles. However, you can add your own permissions to the admin-module.permissions config.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover a security vulnerability, please send an e-mail to dev@hexdigital.com. All security vulnerabilities will be promptly addressed.

Credits

License

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