shushushushushu/laravel-admin

shushushushushu laravel admin

1.2.4 2022-07-07 02:45 UTC

This package is auto-updated.

Last update: 2024-04-07 06:44:21 UTC


README

laravel-admin

laravel-admin is administrative interface builder for laravel which can help you build CRUD backends just with few lines of code.

Documentation | 中文文档 | Demo | Demo source code | Extensions

Inspired by SleepingOwlAdmin and rapyd-laravel.

Sponsor

laravel-admin

###statement This is a replica that clone from laravel-admin,and make some changes to meet product requirements.

Requirements

  • PHP >= 7.0.0
  • Laravel >= 5.5.0
  • Fileinfo PHP Extension

Installation

This package requires PHP 7+ and Laravel 5.5, for old versions please refer to 1.4

First, install laravel 5.5, and make sure that the database connection settings are correct.

composer require shushushushushu/laravel-admin:^1.2.0

Then run these commands to publish assets and config:

php artisan vendor:publish --provider="shushushushushu\Admin\AdminServiceProvider"

After run command you can find config file in config/admin.php, in this file you can change the install directory,db connection or table names.

At last run following command to finish install.

php artisan admin:install

Open http://localhost/admin/ in browser,use username admin and password admin to login.

Configurations

The file config/admin.php contains an array of configurations, you can find the default configurations in there.

Extensions

Extension Description laravel-admin
helpers Several tools to help you in development ~1.5
media-manager Provides a web interface to manage local files ~1.5
api-tester Help you to test the local laravel APIs ~1.5
scheduling Scheduling task manager for laravel-admin ~1.5
redis-manager Redis manager for laravel-admin ~1.5
backup An admin interface for managing backups ~1.5
log-viewer Log viewer for laravel ~1.5
config Config manager for laravel-admin ~1.5
reporter Provides a developer-friendly web interface to view the exception ~1.5
wangEditor A rich text editor based on wangeditor ~1.6
summernote A rich text editor based on summernote ~1.6
china-distpicker 一个基于distpicker的中国省市区选择器 ~1.6
simplemde A markdown editor based on simplemde ~1.6
phpinfo Integrate the phpinfo page into laravel-admin ~1.6
php-editor
python-editor
js-editor
css-editor
clike-editor
Several programing language editor extensions based on code-mirror ~1.6
star-rating Star Rating extension for laravel-admin ~1.6
json-editor JSON Editor for Laravel-admin ~1.6
grid-lightbox Turn your grid into a lightbox & gallery ~1.6
daterangepicker Integrates daterangepicker into laravel-admin ~1.6
material-ui Material-UI extension for laravel-admin ~1.6
sparkline Integrates jQuery sparkline into laravel-admin ~1.6
chartjs Use Chartjs in laravel-admin ~1.6
echarts Use Echarts in laravel-admin ~1.6
simditor Integrates simditor full-rich editor into laravel-admin ~1.6
cropper A simple jQuery image cropping plugin. ~1.6
composer-viewer A web interface of composer packages in laravel. ~1.6
data-table Advanced table widget for laravel-admin ~1.6
watermark Text watermark for laravel-admin ~1.6
google-authenticator Google authenticator ~1.6

Changes

1.method sanitizeInput() in src\Form\Field.php change as:

protected function sanitizeInput($input, $column)
{
    if ($this instanceof Field\MultipleSelect) {
        $value = Arr::get($input, $column);
        Arr::set($input, $column, array_filter($value, function($val){
            return $val !== '' && $val !== null && $val !== false;
        }));
    }
    return $input;
}
purpose: submit form can be access when checkbox select 0 and rule contains required

2.reform component 'Select':

①method ajax() in src\Form\Field\Select.php
change select2's delay time of ajax request from 250ms to 500ms

②change name of a hidden input and set value:
<input type="hidden" name="{{$name}}"/>
change as 
<input type="hidden" name="{{$name}}_hide" value="{{old($column, $value)}}"/>
that can get old value when select option list from ajax request,

3.insert error tips into resources/views/form.blade.php line 12:

@foreach($errors->getBags() as $bags)
    <div class="alert alert-danger">{{$bags->first()}}</div>
@endforeach

4.in order to use alioss and support full url with domain make some changes in src\Form\Field\Image.php -> prepare():

if(isset(config('filesystems.disks.' . config('filesystems.default'))['remote_url'])){
    $remoteUrl = config('filesystems.disks.' . config('filesystems.default'))['remote_url'];
    $path = rtrim($remoteUrl, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $path;
}//add domain before return path if config remote_url

return $path;

5.login page add smscode verify using easy-sms These changes occurs in the tag 1.2.0 and some configuration is needed to make sure it works properly.

①users table add a column:

$table->char('mobile', 11);

②fill configurations of redis and the normal operation of the redis.

③add configuration of easysms to admin.config: first add 'auth/sendsms' to "auth['excepts']" ensure interface 'auth/sendsms' not need auth, and second:

'login_use_sms' => true,

'easysms' => [
    'timeout' => 5.0,
    'length' => 4,
    'expire' => 300,
    'product' => '',
    'default' => [
        'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,
        'gateways' => [
            'aliyun'
        ]
    ],
    'gateways' => [
        'errorlog' => [
            'file' => '/tmp/easy-sms.log',
        ],
        'aliyun' => [
            'access_key_id' => env('ALIYUN_ACCESS_KEY_ID', ''),
            'access_key_secret' => env('ALIYUN_SECRET_ACCESS_KEY', ''),
            'sign_name' => env('ALIYUN_SMS_SIGN_NAME', ''),
        ]
    ]
],

if set login_use_sms=false,sms will be disabled.

you need config some env in .env forexample 'access_key_id' and son on. For details, please see easysms official website

6.src/Form.php:

public function inputAll()
{
    return $this->inputs;
}

License

laravel-admin is licensed under The MIT License (MIT).