File tree Expand file tree Collapse file tree 3 files changed +40
-27
lines changed Expand file tree Collapse file tree 3 files changed +40
-27
lines changed Original file line number Diff line number Diff line change 1- laravel-admin-config
2- ====================
1+ laravel-admin-ext/ config
2+ ========================
33
44[ ![ StyleCI] ( https://styleci.io/repos/97664136/shield?branch=master )] ( https://styleci.io/repos/97664136 )
5- [ ![ Packagist] ( https://img.shields.io/packagist/l/encore/laravel-admin-config.svg?maxAge=2592000 )] ( https://packagist.org/packages/encore/laravel-admin-config )
6- [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/encore/laravel-admin-config.svg?style=flat-square )] ( https://packagist.org/packages/encore/laravel-admin-config )
5+ [ ![ Packagist] ( https://img.shields.io/packagist/l/laravel-admin-ext/config.svg?maxAge=2592000 )] ( https://packagist.org/packages/laravel-admin-ext/config )
6+ [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/laravel-admin-ext/config.svg?style=flat-square )] ( https://packagist.org/packages/laravel-admin-ext/config )
7+
78
8- [ Demo] ( http://120.26.143.106/admin/config ) use ` username/password:admin/admin `
99
1010Inspired by https://github.com/laravel-backpack/settings .
1111
1212## Installation
1313
1414```
15- $ composer require encore/ laravel-admin-config
15+ $ composer require laravel-admin-ext/ config
1616
1717$ php artisan migrate
18+ ```
19+
20+ Open ` app/Providers/AppServiceProvider.php ` , and call the ` Config::boot ` method within the ` boot ` method:
21+
22+ ``` php
23+ <?php
24+
25+ namespace App\Providers;
1826
19- $ php artisan admin:import encore/laravel-admin-config
27+ use Encore\Admin\Config\Config;
28+ use Illuminate\Support\ServiceProvider;
29+
30+ class AppServiceProvider extends ServiceProvider
31+ {
32+ public function boot()
33+ {
34+ Config::boot();
35+ }
36+ }
37+ ```
38+
39+ then run:
40+
41+ ```
42+ $ php artisan admin:import config
2043```
2144
2245Open ` http://your-host/admin/config `
Original file line number Diff line number Diff line change 44use Illuminate \Database \Schema \Blueprint ;
55use Illuminate \Support \Facades \Schema ;
66
7- class CreateSettingsTable extends Migration
7+ class CreateConfigTable extends Migration
88{
99 /**
1010 * Run the migrations.
@@ -21,7 +21,7 @@ public function up()
2121 $ table ->increments ('id ' );
2222 $ table ->string ('name ' )->unique ();
2323 $ table ->string ('value ' );
24- $ table ->text ('description ' );
24+ $ table ->text ('description ' )-> nullable () ;
2525 $ table ->timestamps ();
2626 });
2727 }
Original file line number Diff line number Diff line change 22
33namespace Encore \Admin \Config ;
44
5- use Encore \Admin \Auth \Database \Menu ;
6- use Encore \Admin \Auth \Database \Permission ;
5+ use Encore \Admin \Admin ;
76use Encore \Admin \Extension ;
87use Illuminate \Support \Facades \Route ;
98
@@ -19,6 +18,8 @@ public static function boot()
1918 static ::registerRoutes ();
2019
2120 static ::loadConfig ();
21+
22+ Admin::extend ('config ' , __CLASS__ );
2223 }
2324
2425 /**
@@ -51,24 +52,13 @@ protected static function loadConfig()
5152 }
5253 }
5354
55+ /**
56+ * {@inheritdoc}
57+ */
5458 public static function import ()
5559 {
56- $ lastOrder = Menu::max ('order ' );
57-
58- // Add a menu.
59- Menu::create ([
60- 'parent_id ' => 0 ,
61- 'order ' => $ lastOrder + 1 ,
62- 'title ' => 'Config ' ,
63- 'icon ' => 'fa-toggle-on ' ,
64- 'uri ' => 'config ' ,
65- ]);
60+ parent ::createMenu ('Config ' , 'config ' , 'fa-toggle-on ' );
6661
67- // Add a permission.
68- Permission::create ([
69- 'name ' => 'Admin Config ' ,
70- 'slug ' => 'ext.config ' ,
71- 'http_path ' => admin_base_path ('config* ' ),
72- ]);
62+ parent ::createPermission ('Admin Config ' , 'ext.config ' , 'config* ' );
7363 }
7464}
You can’t perform that action at this time.
0 commit comments