acmepackage/laravel-admin 问题修复 & 功能扩展

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

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

acmepackage/laravel-admin

最新稳定版本:v1.1.2

Composer 安装命令:

composer require acmepackage/laravel-admin

包简介

Laravel Admin Panel

README 文档

README

An admin panel for managing users, roles, permissions & crud.

Requirements

Laravel >=9
PHP >= 8.0
composer `2.4.2`
node `16.17.1`
npm `8.15.0`
WebPack and laravel mix
Now we Support Laravel 9

templates version

Bootstrap v4

AdminLTE 3.1

Features

  • User, Role & Permission Manager
  • CRUD Generator
  • Activity Log
  • Page CRUD
  • Settings

Installation

  1. Run
     composer require acmepackage/laravel-admin
    
  2. Make sure your user model's has a `HasRoles` trait app/Models/User.php.

     class User extends Authenticatable
     {
         use Notifiable, HasRoles;
    
         ...
    
  3. Create auth assets
      php artisan ui bootstrap --auth  
    

    and don't replace auth views

  4. Add the following line to the "web.php" file located in routes folder

     require('admin.php');
    
  5. Register localization middleware in app/Http/Kernel.php

protected $middlewareGroups = [
'web' => [

            \App\Http\Middleware\Localization::class,

        ],

    ];
  1. Run the following command
    php artisan vendor:publish --all
    
  2. Remove your package.json located in the project root dir and rename package.json.example in the same dir to package.json then rename webpack.mix.js.example to webpack.mix.js

  3. Run the following commands to install node and build the node packages

     npm install
    
     npm install --save-dev webpack
    
      npm run dev
    
  4. To create seeder for roles and language, add the following lines to DatabaseSeeder.php in the "run" function

      $this->call([
              RoleTableSeeder::class,
             LanguageTableSeeder::class,
         ]);
    
  5. Finally run

      php artisan migrate --seed
    
  6. Open the following url after running "php artisan serve" your_url/admin

Note: we use webpack only not vite

Note: If you are using Laravel 7+ then scaffold the authentication with bootstrap for a better experience. . You can generate CRUD easily through generator tool now.

Usage

  1. Create some permissions.

  2. Create some roles.

  3. Assign permission(s) to role.

  4. Create user(s) with role.

  5. For checking authenticated user's role see below:

     // Add role middleware in app/Http/Kernel.php
     protected $routeMiddleware = [
         ...
         'role' => \App\Http\Middleware\CheckRole::class,
     ];
    
     // Check role anywhere
     if (Auth::check() && Auth::user()->hasRole('admin')) {
         // Do admin stuff here
     } else {
         // Do nothing
     }
    
     // Check role in route middleware
     Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth', 'role:admin']], function () {
        Route::get('/', ['uses' => 'AdminController@index']);
     });
    
     // Check permission in route middleware
     Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth', 'can:write_user']], function () {
        Route::get('/', ['uses' => 'AdminController@index']);
     });
    
  6. For checking permissions see below:

     if ($user->can('permission-name')) {
         // Do something
     }
    

Learn more about ACL from here

For activity log please read spatie/laravel-activitylog docs

Screenshots

users

activity log

generator

settings

Author

[Mohamed Hassan] :email: Email Me

reference

Sohel Amin :email: Email Me

License

This project is licensed under the MIT License - see the License File for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固