PHP code example of houdunwang / laravel-module

1. Go to this page and download the library: Download houdunwang/laravel-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

houdunwang / laravel-module example snippets


php artisan hd:module Admin

php artisan hd:config Admin

function saveConfig(array $data = [], $name = 'config')

php artisan hd:permission Admin

php artisan hd:permission

 return [
    [
        'group' => '文章管理',
        'permissions' => [
            ['title' => '添加栏目', 'name' => 'Modules\Admin\Http\Controllers\CategoryController@create', 'guard' => 'admin'],
        ],
    ],
];


#config/permisson.php
return [
    [
        'group'       => '文章管理',
        'permissions' => [
            ['title' => '编辑管理', 'name' => 'Modules\Admin\Http\Controllers\ArticleController@edit', 'guard' => 'admin'],
        ],
    ],
];

Route::group([
    'middleware' => ['web', 'auth:admin'],'prefix'     => 'admin','namespace'  => 'Modules\Admin\Http\Controllers'], function () {
	Route::resource('edit_article', 'ArticleController@edit')->middleware("permission:admin");
});

#$module——模块标识
\HDModule::getModulePath($module = null);

php artisan hd:model Category Article

php artisan hd:autocreate Modules/Article/Entities/Category.php 文章