benjamin-chen/laravel-admin-package

v0.1.1 2017-02-10 07:10 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:48:11 UTC


README

这是一个简单的Laravel管理包。

Composer

composer require benjamin-chen/laravel-admin-package

设置

将AdminServiceProvider添加到app配置中

将AdminServiceProvider添加到config/app.php文件中服务提供者数组

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        // ... other providers
        Illuminate\View\ViewServiceProvider::class,
        BenjaminChen\Admin\AdminServiceProvider::class,

公开资源

php artisan vendor:publish --tag=public

公开迁移

php artisan vendor:publish --tag="migrations"

公开配置

php artisan vendor:publish --tag="config"

在公开路径中创建上传文件夹

在您的公开路径中创建“upload”文件夹,并将“upload”文件夹的权限更改为777。

在您的模型类中添加公开变量

public $columns = [
        'input' => [
            'name' => [
                'type' => 'text',
                'placeholder' => 'Please input your name',
            ],
            'email' => [
                'type' => 'email'
            ],
        ],
        'select' => [
            'sex' => [
                'option' => [
                    'Female' => 0,
                    'Male' => 1,
                ],
            ]
        ],
        'textarea' => [
            'blog' => [
                'rows' => 5,
            ]
        ],
        'file' => [
            'photo' => [
                'type' => 'image',
            ]
        ],
        'inputValidator' => [
            'name' => 'required',
            'email' => 'required|email|unique:users',
            'sex' => 'required',
        ]
];