first commit
This commit is contained in:
7
vendor/laravel-admin-ext/china-distpicker/.gitignore
vendored
Normal file
7
vendor/laravel-admin-ext/china-distpicker/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
phpunit.phar
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
*.project
|
||||
.idea/
|
||||
20
vendor/laravel-admin-ext/china-distpicker/LICENSE
vendored
Normal file
20
vendor/laravel-admin-ext/china-distpicker/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jens Segers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
102
vendor/laravel-admin-ext/china-distpicker/README.md
vendored
Normal file
102
vendor/laravel-admin-ext/china-distpicker/README.md
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
Distpicker extension for laravel-admin
|
||||
======
|
||||
|
||||
[Distpicker](https://github.com/fengyuanchen/distpicker)是一个中国省市区三级联动选择组件,这个包是基于`Distpicker`的`laravel-admin`扩展,用来将`Distpicker`集成进`laravel-admin`的表单中
|
||||
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
composer require laravel-admin-ext/china-distpicker
|
||||
```
|
||||
|
||||
然后
|
||||
```bash
|
||||
php artisan vendor:publish --tag=laravel-admin-china-distpicker
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
在`config/admin.php`文件的`extensions`配置部分,加上属于这个扩展的配置
|
||||
```php
|
||||
|
||||
'extensions' => [
|
||||
|
||||
'china-distpicker' => [
|
||||
|
||||
// 如果要关掉这个扩展,设置为false
|
||||
'enable' => true,
|
||||
]
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
### 表单中使用
|
||||
|
||||
比如在表中有三个字段`province_id`, `city_id`, `district_id`, 在form表单中使用它:
|
||||
|
||||
```php
|
||||
$form->distpicker(['province_id', 'city_id', 'district_id']);
|
||||
```
|
||||
|
||||
设置默认值
|
||||
```php
|
||||
|
||||
$form->distpicker([
|
||||
'province_id' => '省份',
|
||||
'city_id' => '市',
|
||||
'district_id' => '区'
|
||||
], '地域选择')->default([
|
||||
'province' => 130000,
|
||||
'city' => 130200,
|
||||
'district' => 130203,
|
||||
]);
|
||||
```
|
||||
|
||||
可以设置每个字段的placeholder
|
||||
|
||||
```php
|
||||
$form->distpicker([
|
||||
'province_id' => '省',
|
||||
'city_id' => '市',
|
||||
'district_id' => '区'
|
||||
]);
|
||||
```
|
||||
|
||||
设置label
|
||||
|
||||
```php
|
||||
$form->distpicker(['province_id', 'city_id', 'district_id'], '请选择区域');
|
||||
```
|
||||
|
||||
设置自动选择, 可以设置1,2,3 表示自动选择到第几级
|
||||
|
||||
```php
|
||||
$form->distpicker(['province_id', 'city_id', 'district_id'])->autoselect(1);
|
||||
|
||||
```
|
||||
|
||||
### 表格筛选中使用
|
||||
|
||||
```php
|
||||
$filter->distpicker('province_id', 'city_id', 'district_id', '地域选择');
|
||||
```
|
||||
|
||||
## 地区编码数据
|
||||
|
||||
[Distpicker](https://github.com/fengyuanchen/distpicker)所使用的地域编码是基于国家统计局发布的数据, 数据字典为`china_area.sql`文件.
|
||||
|
||||
## 支持
|
||||
|
||||
如果觉得这个项目帮你节约了时间,不妨支持一下;)
|
||||
|
||||

|
||||
|
||||
License
|
||||
------------
|
||||
Licensed under [The MIT License (MIT)](LICENSE).
|
||||
55
vendor/laravel-admin-ext/china-distpicker/china_area.sql
vendored
Normal file
55
vendor/laravel-admin-ext/china-distpicker/china_area.sql
vendored
Normal file
File diff suppressed because one or more lines are too long
34
vendor/laravel-admin-ext/china-distpicker/composer.json
vendored
Normal file
34
vendor/laravel-admin-ext/china-distpicker/composer.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "laravel-admin-ext/china-distpicker",
|
||||
"description": "Distpicker extension for laravel-admin",
|
||||
"type": "library",
|
||||
"keywords": ["laravel-admin", "extension", "distpicker"],
|
||||
"homepage": "https://github.com/laravel-admin-ext/china-distpicker",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "song",
|
||||
"email": "zosong@126.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"encore/laravel-admin": "~1.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Encore\\ChinaDistpicker\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Encore\\ChinaDistpicker\\ChinaDistpickerServiceProvider"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
4427
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.common.js
vendored
Normal file
4427
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.common.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4423
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.esm.js
vendored
Normal file
4423
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.esm.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4431
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.js
vendored
Normal file
4431
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.min.js
vendored
Normal file
10
vendor/laravel-admin-ext/china-distpicker/resources/assets/dist/distpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
vendor/laravel-admin-ext/china-distpicker/resources/views/filter.blade.php
vendored
Normal file
5
vendor/laravel-admin-ext/china-distpicker/resources/views/filter.blade.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="{{ $id }}" class="form-inline" data-value-type="code">
|
||||
<select class="form-control" name="{{$name['province']}}"></select>
|
||||
<select class="form-control" name="{{$name['city']}}"></select>
|
||||
<select class="form-control" name="{{$name['district']}}"></select>
|
||||
</div>
|
||||
23
vendor/laravel-admin-ext/china-distpicker/resources/views/select.blade.php
vendored
Normal file
23
vendor/laravel-admin-ext/china-distpicker/resources/views/select.blade.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="{{$viewClass['form-group']}} {!! !$errors->hasAny($errorKey) ? '' : 'has-error' !!}">
|
||||
|
||||
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
|
||||
|
||||
<div class="{{$viewClass['field']}} form-inline">
|
||||
|
||||
@foreach($errorKey as $key => $col)
|
||||
@if($errors->has($col))
|
||||
@foreach($errors->get($col) as $message)
|
||||
<label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$message}}</label><br/>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div id="{{ $id }}" {!! $attributes !!}>
|
||||
<select class="form-control" name="{{$name['province']}}"></select>
|
||||
<select class="form-control" name="{{$name['city']}}"></select>
|
||||
<select class="form-control" name="{{$name['district']}}"></select>
|
||||
</div>
|
||||
@include('admin::form.help-block')
|
||||
|
||||
</div>
|
||||
</div>
|
||||
14
vendor/laravel-admin-ext/china-distpicker/src/ChinaDistpicker.php
vendored
Normal file
14
vendor/laravel-admin-ext/china-distpicker/src/ChinaDistpicker.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\ChinaDistpicker;
|
||||
|
||||
use Encore\Admin\Extension;
|
||||
|
||||
class ChinaDistpicker extends Extension
|
||||
{
|
||||
public $name = 'china-distpicker';
|
||||
|
||||
public $views = __DIR__.'/../resources/views';
|
||||
|
||||
public $assets = __DIR__.'/../resources/assets';
|
||||
}
|
||||
37
vendor/laravel-admin-ext/china-distpicker/src/ChinaDistpickerServiceProvider.php
vendored
Normal file
37
vendor/laravel-admin-ext/china-distpicker/src/ChinaDistpickerServiceProvider.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\ChinaDistpicker;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid\Filter;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ChinaDistpickerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function boot(ChinaDistpicker $extension)
|
||||
{
|
||||
if (! ChinaDistpicker::boot()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if ($views = $extension->views()) {
|
||||
$this->loadViewsFrom($views, 'laravel-admin-china-distpicker');
|
||||
}
|
||||
|
||||
if ($this->app->runningInConsole() && $assets = $extension->assets()) {
|
||||
$this->publishes(
|
||||
[$assets => public_path('vendor/laravel-admin-ext/china-distpicker')],
|
||||
'laravel-admin-china-distpicker'
|
||||
);
|
||||
}
|
||||
|
||||
Admin::booting(function () {
|
||||
Form::extend('distpicker', Distpicker::class);
|
||||
Filter::extend('distpicker', DistpickerFilter::class);
|
||||
});
|
||||
}
|
||||
}
|
||||
106
vendor/laravel-admin-ext/china-distpicker/src/Distpicker.php
vendored
Normal file
106
vendor/laravel-admin-ext/china-distpicker/src/Distpicker.php
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\ChinaDistpicker;
|
||||
|
||||
use Encore\Admin\Form\Field;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Distpicker extends Field
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $view = 'laravel-admin-china-distpicker::select';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $js = [
|
||||
'vendor/laravel-admin-ext/china-distpicker/dist/distpicker.min.js',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $columnKeys = ['province', 'city', 'district'];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $placeholder = [];
|
||||
|
||||
/**
|
||||
* Distpicker constructor.
|
||||
*
|
||||
* @param array $column
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __construct($column, $arguments)
|
||||
{
|
||||
if (!Arr::isAssoc($column)) {
|
||||
$this->column = array_combine($this->columnKeys, $column);
|
||||
} else {
|
||||
$this->column = array_combine($this->columnKeys, array_keys($column));
|
||||
$this->placeholder = array_combine($this->columnKeys, $column);
|
||||
}
|
||||
|
||||
$this->label = empty($arguments) ? '地区选择' : current($arguments);
|
||||
}
|
||||
|
||||
public function getValidator(array $input)
|
||||
{
|
||||
if ($this->validator) {
|
||||
return $this->validator->call($this, $input);
|
||||
}
|
||||
|
||||
$rules = $attributes = [];
|
||||
|
||||
if (!$fieldRules = $this->getRules()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->column as $key => $column) {
|
||||
if (!Arr::has($input, $column)) {
|
||||
continue;
|
||||
}
|
||||
$input[$column] = Arr::get($input, $column);
|
||||
$rules[$column] = $fieldRules;
|
||||
$attributes[$column] = $this->label . "[$column]";
|
||||
}
|
||||
|
||||
return \validator($input, $rules, $this->getValidationMessages(), $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $count
|
||||
* @return $this
|
||||
*/
|
||||
public function autoselect($count = 0)
|
||||
{
|
||||
return $this->attribute('data-autoselect', $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->attribute('data-value-type', 'code');
|
||||
|
||||
$province = old($this->column['province'], Arr::get($this->value(), 'province')) ?: Arr::get($this->placeholder, 'province');
|
||||
$city = old($this->column['city'], Arr::get($this->value(), 'city')) ?: Arr::get($this->placeholder, 'city');
|
||||
$district = old($this->column['district'], Arr::get($this->value(), 'district')) ?: Arr::get($this->placeholder, 'district');
|
||||
|
||||
$id = uniqid('distpicker-');
|
||||
|
||||
$this->script = <<<EOT
|
||||
$("#{$id}").distpicker({
|
||||
province: '$province',
|
||||
city: '$city',
|
||||
district: '$district'
|
||||
});
|
||||
EOT;
|
||||
|
||||
return parent::render()->with(compact('id'));
|
||||
}
|
||||
}
|
||||
153
vendor/laravel-admin-ext/china-distpicker/src/DistpickerFilter.php
vendored
Normal file
153
vendor/laravel-admin-ext/china-distpicker/src/DistpickerFilter.php
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\ChinaDistpicker;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Grid\Filter\AbstractFilter;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DistpickerFilter extends AbstractFilter
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $column = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $value = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultValue = [];
|
||||
|
||||
/**
|
||||
* DistpickerFilter constructor.
|
||||
*
|
||||
* @param string $province
|
||||
* @param string $city
|
||||
* @param string $district
|
||||
* @param string $label
|
||||
*/
|
||||
public function __construct($province, $city, $district, $label = '')
|
||||
{
|
||||
$this->column = compact('province', 'city', 'district');
|
||||
$this->label = $label;
|
||||
|
||||
$this->setPresenter(new FilterPresenter());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
$columns = [];
|
||||
|
||||
$parentName = $this->parent->getName();
|
||||
|
||||
foreach ($this->column as $column) {
|
||||
$columns[] = $parentName ? "{$parentName}_{$column}" : $column;
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function condition($inputs)
|
||||
{
|
||||
$value = array_filter([
|
||||
$this->column['province'] => Arr::get($inputs, $this->column['province']),
|
||||
$this->column['city'] => Arr::get($inputs, $this->column['city']),
|
||||
$this->column['district'] => Arr::get($inputs, $this->column['district']),
|
||||
]);
|
||||
|
||||
if (!isset($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->value = $value;
|
||||
|
||||
if (Str::contains(key($value), '.')) {
|
||||
return $this->buildRelationQuery($value);
|
||||
}
|
||||
|
||||
return [$this->query => [$value]];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function buildRelationQuery($columns = [])
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach ($columns as $column => $value) {
|
||||
Arr::set($data, $column, $value);
|
||||
}
|
||||
|
||||
$relation = key($data);
|
||||
|
||||
$args = $data[$relation];
|
||||
|
||||
return ['whereHas' => [$relation, function ($relation) use ($args) {
|
||||
call_user_func_array([$relation, $this->query], [$args]);
|
||||
}]];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatName($column)
|
||||
{
|
||||
$columns = [];
|
||||
|
||||
foreach ($column as $col => $name) {
|
||||
$columns[$col] = parent::formatName($name);
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup js scripts.
|
||||
*/
|
||||
protected function setupScript()
|
||||
{
|
||||
$province = old($this->column['province'], Arr::get($this->value, $this->column['province']));
|
||||
$city = old($this->column['city'], Arr::get($this->value, $this->column['city']));
|
||||
$district = old($this->column['district'], Arr::get($this->value, $this->column['district']));
|
||||
|
||||
$script = <<<EOT
|
||||
$("#{$this->id}").distpicker({
|
||||
province: '$province',
|
||||
city: '$city',
|
||||
district: '$district'
|
||||
});
|
||||
EOT;
|
||||
Admin::script($script);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function variables()
|
||||
{
|
||||
$this->id = 'distpicker-filter-' . uniqid();
|
||||
|
||||
$this->setupScript();
|
||||
|
||||
return array_merge([
|
||||
'id' => $this->id,
|
||||
'name' => $this->formatName($this->column),
|
||||
'label' => $this->label,
|
||||
'value' => $this->value ?: $this->defaultValue,
|
||||
'presenter' => $this->presenter(),
|
||||
], $this->presenter()->variables());
|
||||
}
|
||||
}
|
||||
13
vendor/laravel-admin-ext/china-distpicker/src/FilterPresenter.php
vendored
Normal file
13
vendor/laravel-admin-ext/china-distpicker/src/FilterPresenter.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\ChinaDistpicker;
|
||||
|
||||
use Encore\Admin\Grid\Filter\Presenter\Presenter;
|
||||
|
||||
class FilterPresenter extends Presenter
|
||||
{
|
||||
public function view() : string
|
||||
{
|
||||
return 'laravel-admin-china-distpicker::filter';
|
||||
}
|
||||
}
|
||||
7
vendor/laravel-admin-ext/config/.gitignore
vendored
Normal file
7
vendor/laravel-admin-ext/config/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
phpunit.phar
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
*.project
|
||||
.idea/
|
||||
20
vendor/laravel-admin-ext/config/LICENSE
vendored
Normal file
20
vendor/laravel-admin-ext/config/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jens Segers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
60
vendor/laravel-admin-ext/config/README.md
vendored
Normal file
60
vendor/laravel-admin-ext/config/README.md
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
Config manager for laravel-admin
|
||||
========================
|
||||
|
||||
[](https://styleci.io/repos/97900916)
|
||||
[](https://packagist.org/packages/laravel-admin-ext/config)
|
||||
[](https://packagist.org/packages/laravel-admin-ext/config)
|
||||
[]()
|
||||
|
||||
Inspired by https://github.com/laravel-backpack/settings.
|
||||
|
||||
[Documentation](http://laravel-admin.org/docs/#/en/extension-config) | [中文文档](http://laravel-admin.org/docs/#/zh/extension-config)
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ composer require laravel-admin-ext/config
|
||||
|
||||
$ php artisan migrate
|
||||
```
|
||||
|
||||
Open `app/Providers/AppServiceProvider.php`, and call the `Config::load()` method within the `boot` method:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Encore\Admin\Config\Config;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
if (class_exists(Config::class)) {
|
||||
Config::load();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```
|
||||
$ php artisan admin:import config
|
||||
```
|
||||
|
||||
Open `http://your-host/admin/config`
|
||||
|
||||
## Usage
|
||||
|
||||
After add config in the panel, use `config($key)` to get value you configured.
|
||||
|
||||
License
|
||||
------------
|
||||
Licensed under [The MIT License (MIT)](LICENSE).
|
||||
35
vendor/laravel-admin-ext/config/composer.json
vendored
Normal file
35
vendor/laravel-admin-ext/config/composer.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "laravel-admin-ext/config",
|
||||
"description": "Config extension for laravel-admin",
|
||||
"type": "library",
|
||||
"keywords": ["laravel-admin", "setting"],
|
||||
"homepage": "https://github.com/laravel-admin-extensions/config",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "z-song",
|
||||
"email": "zosong@126.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"laravel/framework": "~5.5",
|
||||
"encore/laravel-admin": "~1.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0",
|
||||
"laravel/laravel": "~5.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Encore\\Admin\\Config\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Encore\\Admin\\Config\\ConfigServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
59
vendor/laravel-admin-ext/config/src/Config.php
vendored
Normal file
59
vendor/laravel-admin-ext/config/src/Config.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Admin\Config;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Extension;
|
||||
|
||||
class Config extends Extension
|
||||
{
|
||||
/**
|
||||
* Load configure into laravel from database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function load()
|
||||
{
|
||||
foreach (ConfigModel::all(['name', 'value']) as $config) {
|
||||
config([$config['name'] => $config['value']]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap this package.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
static::registerRoutes();
|
||||
|
||||
Admin::extend('config', __CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register routes for laravel-admin.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function registerRoutes()
|
||||
{
|
||||
parent::routes(function ($router) {
|
||||
/* @var \Illuminate\Routing\Router $router */
|
||||
$router->resource(
|
||||
config('admin.extensions.config.name', 'config'),
|
||||
config('admin.extensions.config.controller', 'Encore\Admin\Config\ConfigController')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function import()
|
||||
{
|
||||
parent::createMenu('Config', 'config', 'fa-toggle-on');
|
||||
|
||||
parent::createPermission('Admin Config', 'ext.config', 'config*');
|
||||
}
|
||||
}
|
||||
112
vendor/laravel-admin-ext/config/src/ConfigController.php
vendored
Normal file
112
vendor/laravel-admin-ext/config/src/ConfigController.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Admin\Config;
|
||||
|
||||
use Encore\Admin\Controllers\HasResourceActions;
|
||||
use Encore\Admin\Facades\Admin;
|
||||
use Encore\Admin\Form;
|
||||
use Encore\Admin\Grid;
|
||||
use Encore\Admin\Layout\Content;
|
||||
use Encore\Admin\Show;
|
||||
|
||||
class ConfigController
|
||||
{
|
||||
use HasResourceActions;
|
||||
|
||||
/**
|
||||
* Index interface.
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
public function index(Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('Config')
|
||||
->description('list')
|
||||
->body($this->grid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit interface.
|
||||
*
|
||||
* @param int $id
|
||||
* @param Content $content
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
public function edit($id, Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('Config')
|
||||
->description('edit')
|
||||
->body($this->form()->edit($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create interface.
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
public function create(Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('Config')
|
||||
->description('create')
|
||||
->body($this->form());
|
||||
}
|
||||
|
||||
public function show($id, Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('Config')
|
||||
->description('detail')
|
||||
->body(Admin::show(ConfigModel::findOrFail($id), function (Show $show) {
|
||||
$show->id();
|
||||
$show->name();
|
||||
$show->value();
|
||||
$show->description();
|
||||
$show->created_at();
|
||||
$show->updated_at();
|
||||
}));
|
||||
}
|
||||
|
||||
public function grid()
|
||||
{
|
||||
$grid = new Grid(new ConfigModel());
|
||||
|
||||
$grid->id('ID')->sortable();
|
||||
$grid->name()->display(function ($name) {
|
||||
return "<a tabindex=\"0\" class=\"btn btn-xs btn-twitter\" role=\"button\" data-toggle=\"popover\" data-html=true title=\"Usage\" data-content=\"<code>config('$name');</code>\">$name</a>";
|
||||
});
|
||||
$grid->value();
|
||||
$grid->description();
|
||||
|
||||
$grid->created_at();
|
||||
$grid->updated_at();
|
||||
|
||||
$grid->filter(function ($filter) {
|
||||
$filter->disableIdFilter();
|
||||
$filter->like('name');
|
||||
$filter->like('value');
|
||||
});
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
$form = new Form(new ConfigModel());
|
||||
|
||||
$form->display('id', 'ID');
|
||||
$form->text('name')->rules('required');
|
||||
$form->textarea('value')->rules('required');
|
||||
$form->textarea('description');
|
||||
|
||||
$form->display('created_at');
|
||||
$form->display('updated_at');
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
22
vendor/laravel-admin-ext/config/src/ConfigModel.php
vendored
Normal file
22
vendor/laravel-admin-ext/config/src/ConfigModel.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Admin\Config;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ConfigModel extends Model
|
||||
{
|
||||
/**
|
||||
* Settings constructor.
|
||||
*
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setConnection(config('admin.database.connection') ?: config('database.default'));
|
||||
|
||||
$this->setTable(config('admin.extensions.config.table', 'admin_config'));
|
||||
}
|
||||
}
|
||||
20
vendor/laravel-admin-ext/config/src/ConfigServiceProvider.php
vendored
Normal file
20
vendor/laravel-admin-ext/config/src/ConfigServiceProvider.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Admin\Config;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ConfigServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
|
||||
}
|
||||
|
||||
Config::boot();
|
||||
}
|
||||
}
|
||||
7
vendor/laravel-admin-ext/grid-lightbox/.gitignore
vendored
Normal file
7
vendor/laravel-admin-ext/grid-lightbox/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
phpunit.phar
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
*.project
|
||||
.idea/
|
||||
20
vendor/laravel-admin-ext/grid-lightbox/LICENSE
vendored
Normal file
20
vendor/laravel-admin-ext/grid-lightbox/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jens Segers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
68
vendor/laravel-admin-ext/grid-lightbox/README.md
vendored
Normal file
68
vendor/laravel-admin-ext/grid-lightbox/README.md
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
Turn your grid into a lightbox & gallery
|
||||
======
|
||||
|
||||
This is an extension to integrates [Magnific Popup](http://dimsemenov.com/plugins/magnific-popup/) into laravel-admin.
|
||||
|
||||
DEMO [lightbox](http://demo.laravel-admin.org/lightbox/lightbox) & [gallery](http://demo.laravel-admin.org/lightbox/gallery)
|
||||
|
||||
Login using `admin/admin`
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
composer require laravel-admin-ext/grid-lightbox
|
||||
|
||||
php artisan vendor:publish --tag=laravel-admin-grid-lightbox
|
||||
```
|
||||
|
||||
## Configurations
|
||||
|
||||
Open `config/admin.php`, add configurations that belong to this extension at `extensions` section.
|
||||
```php
|
||||
|
||||
'extensions' => [
|
||||
|
||||
'grid-lightbox' => [
|
||||
|
||||
// Set to `false` if you want to disable this extension
|
||||
'enable' => true,
|
||||
]
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Use it in the grid:
|
||||
```php
|
||||
// simple lightbox
|
||||
$grid->picture()->lightbox();
|
||||
|
||||
//gallery
|
||||
$grid->picture()->gallery();
|
||||
|
||||
//zoom effect
|
||||
$grid->picture()->lightbox(['zooming' => true]);
|
||||
$grid->picture()->gallery(['zooming' => true]);
|
||||
|
||||
//width & height properties
|
||||
$grid->picture()->lightbox(['width' => 50, 'height' => 50]);
|
||||
$grid->picture()->gallery(['width' => 50, 'height' => 50]);
|
||||
|
||||
//img class properties
|
||||
$grid->picture()->lightbox(['class' => 'rounded']);
|
||||
$grid->picture()->gallery(['class' => ['circle', 'thumbnail']]);
|
||||
```
|
||||
|
||||
## Donate
|
||||
|
||||
> Help keeping the project development going, by donating a little. Thanks in advance.
|
||||
|
||||
[](https://www.paypal.me/zousong)
|
||||
|
||||

|
||||
|
||||
License
|
||||
------------
|
||||
Licensed under [The MIT License (MIT)](LICENSE).
|
||||
|
||||
34
vendor/laravel-admin-ext/grid-lightbox/composer.json
vendored
Normal file
34
vendor/laravel-admin-ext/grid-lightbox/composer.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "laravel-admin-ext/grid-lightbox",
|
||||
"description": "Turn your grid into a lightbox & gallery",
|
||||
"type": "library",
|
||||
"keywords": ["laravel-admin", "extension", "grid", "lightbox", "gallery"],
|
||||
"homepage": "https://github.com/laravel-admin-ext/grid-lightbox",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "song",
|
||||
"email": "zosong@126.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"encore/laravel-admin": "~1.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Encore\\Grid\\Lightbox\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Encore\\Grid\\Lightbox\\LightboxServiceProvider"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
4
vendor/laravel-admin-ext/grid-lightbox/resources/assets/jquery.magnific-popup.min.js
vendored
Normal file
4
vendor/laravel-admin-ext/grid-lightbox/resources/assets/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
351
vendor/laravel-admin-ext/grid-lightbox/resources/assets/magnific-popup.css
vendored
Normal file
351
vendor/laravel-admin-ext/grid-lightbox/resources/assets/magnific-popup.css
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
/* Magnific Popup CSS */
|
||||
.mfp-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1042;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
background: #0b0b0b;
|
||||
opacity: 0.8; }
|
||||
|
||||
.mfp-wrap {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1043;
|
||||
position: fixed;
|
||||
outline: none !important;
|
||||
-webkit-backface-visibility: hidden; }
|
||||
|
||||
.mfp-container {
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.mfp-container:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle; }
|
||||
|
||||
.mfp-align-top .mfp-container:before {
|
||||
display: none; }
|
||||
|
||||
.mfp-content {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
z-index: 1045; }
|
||||
|
||||
.mfp-inline-holder .mfp-content,
|
||||
.mfp-ajax-holder .mfp-content {
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-ajax-cur {
|
||||
cursor: progress; }
|
||||
|
||||
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
|
||||
cursor: -moz-zoom-out;
|
||||
cursor: -webkit-zoom-out;
|
||||
cursor: zoom-out; }
|
||||
|
||||
.mfp-zoom {
|
||||
cursor: pointer;
|
||||
cursor: -webkit-zoom-in;
|
||||
cursor: -moz-zoom-in;
|
||||
cursor: zoom-in; }
|
||||
|
||||
.mfp-auto-cursor .mfp-content {
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-close,
|
||||
.mfp-arrow,
|
||||
.mfp-preloader,
|
||||
.mfp-counter {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none; }
|
||||
|
||||
.mfp-loading.mfp-figure {
|
||||
display: none; }
|
||||
|
||||
.mfp-hide {
|
||||
display: none !important; }
|
||||
|
||||
.mfp-preloader {
|
||||
color: #CCC;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin-top: -0.8em;
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
z-index: 1044; }
|
||||
.mfp-preloader a {
|
||||
color: #CCC; }
|
||||
.mfp-preloader a:hover {
|
||||
color: #FFF; }
|
||||
|
||||
.mfp-s-ready .mfp-preloader {
|
||||
display: none; }
|
||||
|
||||
.mfp-s-error .mfp-content {
|
||||
display: none; }
|
||||
|
||||
button.mfp-close,
|
||||
button.mfp-arrow {
|
||||
overflow: visible;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
z-index: 1046;
|
||||
box-shadow: none;
|
||||
touch-action: manipulation; }
|
||||
|
||||
button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0; }
|
||||
|
||||
.mfp-close {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
opacity: 0.65;
|
||||
padding: 0 0 18px 10px;
|
||||
color: #FFF;
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
font-family: Arial, Baskerville, monospace; }
|
||||
.mfp-close:hover,
|
||||
.mfp-close:focus {
|
||||
opacity: 1; }
|
||||
.mfp-close:active {
|
||||
top: 1px; }
|
||||
|
||||
.mfp-close-btn-in .mfp-close {
|
||||
color: #333; }
|
||||
|
||||
.mfp-image-holder .mfp-close,
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
color: #FFF;
|
||||
right: -6px;
|
||||
text-align: right;
|
||||
padding-right: 6px;
|
||||
width: 100%; }
|
||||
|
||||
.mfp-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
color: #CCC;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap; }
|
||||
|
||||
.mfp-arrow {
|
||||
position: absolute;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
top: 50%;
|
||||
margin-top: -55px;
|
||||
padding: 0;
|
||||
width: 90px;
|
||||
height: 110px;
|
||||
-webkit-tap-highlight-color: transparent; }
|
||||
.mfp-arrow:active {
|
||||
margin-top: -54px; }
|
||||
.mfp-arrow:hover,
|
||||
.mfp-arrow:focus {
|
||||
opacity: 1; }
|
||||
.mfp-arrow:before,
|
||||
.mfp-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin-top: 35px;
|
||||
margin-left: 35px;
|
||||
border: medium inset transparent; }
|
||||
.mfp-arrow:after {
|
||||
border-top-width: 13px;
|
||||
border-bottom-width: 13px;
|
||||
top: 8px; }
|
||||
.mfp-arrow:before {
|
||||
border-top-width: 21px;
|
||||
border-bottom-width: 21px;
|
||||
opacity: 0.7; }
|
||||
|
||||
.mfp-arrow-left {
|
||||
left: 0; }
|
||||
.mfp-arrow-left:after {
|
||||
border-right: 17px solid #FFF;
|
||||
margin-left: 31px; }
|
||||
.mfp-arrow-left:before {
|
||||
margin-left: 25px;
|
||||
border-right: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-arrow-right {
|
||||
right: 0; }
|
||||
.mfp-arrow-right:after {
|
||||
border-left: 17px solid #FFF;
|
||||
margin-left: 39px; }
|
||||
.mfp-arrow-right:before {
|
||||
border-left: 27px solid #3F3F3F; }
|
||||
|
||||
.mfp-iframe-holder {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px; }
|
||||
.mfp-iframe-holder .mfp-content {
|
||||
line-height: 0;
|
||||
width: 100%;
|
||||
max-width: 900px; }
|
||||
.mfp-iframe-holder .mfp-close {
|
||||
top: -40px; }
|
||||
|
||||
.mfp-iframe-scaler {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 56.25%; }
|
||||
.mfp-iframe-scaler iframe {
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #000; }
|
||||
|
||||
/* Main image in popup */
|
||||
img.mfp-img {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 40px 0 40px;
|
||||
margin: 0 auto; }
|
||||
|
||||
/* The shadow behind the image */
|
||||
.mfp-figure {
|
||||
line-height: 0; }
|
||||
.mfp-figure:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 40px;
|
||||
bottom: 40px;
|
||||
display: block;
|
||||
right: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
z-index: -1;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
|
||||
background: #444; }
|
||||
.mfp-figure small {
|
||||
color: #BDBDBD;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 14px; }
|
||||
.mfp-figure figure {
|
||||
margin: 0; }
|
||||
|
||||
.mfp-bottom-bar {
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
cursor: auto; }
|
||||
|
||||
.mfp-title {
|
||||
text-align: left;
|
||||
line-height: 18px;
|
||||
color: #F3F3F3;
|
||||
word-wrap: break-word;
|
||||
padding-right: 36px; }
|
||||
|
||||
.mfp-image-holder .mfp-content {
|
||||
max-width: 100%; }
|
||||
|
||||
.mfp-gallery .mfp-image-holder .mfp-figure {
|
||||
cursor: pointer; }
|
||||
|
||||
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
|
||||
/**
|
||||
* Remove all paddings around the image on small screen
|
||||
*/
|
||||
.mfp-img-mobile .mfp-image-holder {
|
||||
padding-left: 0;
|
||||
padding-right: 0; }
|
||||
.mfp-img-mobile img.mfp-img {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-figure:after {
|
||||
top: 0;
|
||||
bottom: 0; }
|
||||
.mfp-img-mobile .mfp-figure small {
|
||||
display: inline;
|
||||
margin-left: 5px; }
|
||||
.mfp-img-mobile .mfp-bottom-bar {
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
top: auto;
|
||||
padding: 3px 5px;
|
||||
position: fixed;
|
||||
box-sizing: border-box; }
|
||||
.mfp-img-mobile .mfp-bottom-bar:empty {
|
||||
padding: 0; }
|
||||
.mfp-img-mobile .mfp-counter {
|
||||
right: 5px;
|
||||
top: 3px; }
|
||||
.mfp-img-mobile .mfp-close {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
padding: 0; } }
|
||||
|
||||
@media all and (max-width: 900px) {
|
||||
.mfp-arrow {
|
||||
-webkit-transform: scale(0.75);
|
||||
transform: scale(0.75); }
|
||||
.mfp-arrow-left {
|
||||
-webkit-transform-origin: 0;
|
||||
transform-origin: 0; }
|
||||
.mfp-arrow-right {
|
||||
-webkit-transform-origin: 100%;
|
||||
transform-origin: 100%; }
|
||||
.mfp-container {
|
||||
padding-left: 6px;
|
||||
padding-right: 6px; } }
|
||||
19
vendor/laravel-admin-ext/grid-lightbox/src/GalleryDisplayer.php
vendored
Normal file
19
vendor/laravel-admin-ext/grid-lightbox/src/GalleryDisplayer.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Grid\Lightbox;
|
||||
|
||||
class GalleryDisplayer extends LightboxDisplayer
|
||||
{
|
||||
public $options = [
|
||||
'type' => 'image',
|
||||
'gallery' => [
|
||||
'enabled' => true,
|
||||
'preload' => [0, 2],
|
||||
'navigateByImgClick' => true,
|
||||
'arrowMarkup' => '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
|
||||
'tPrev' => 'Previous (Left arrow key)',
|
||||
'tNext' => 'Next (Right arrow key)',
|
||||
'tCounter' => '<span class="mfp-counter">%curr% of %total%</span>'
|
||||
]
|
||||
];
|
||||
}
|
||||
12
vendor/laravel-admin-ext/grid-lightbox/src/Lightbox.php
vendored
Normal file
12
vendor/laravel-admin-ext/grid-lightbox/src/Lightbox.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Grid\Lightbox;
|
||||
|
||||
use Encore\Admin\Extension;
|
||||
|
||||
class Lightbox extends Extension
|
||||
{
|
||||
public $name = 'grid-lightbox';
|
||||
|
||||
public $assets = __DIR__.'/../resources/assets';
|
||||
}
|
||||
76
vendor/laravel-admin-ext/grid-lightbox/src/LightboxDisplayer.php
vendored
Normal file
76
vendor/laravel-admin-ext/grid-lightbox/src/LightboxDisplayer.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Grid\Lightbox;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Grid\Displayers\AbstractDisplayer;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class LightboxDisplayer extends AbstractDisplayer
|
||||
{
|
||||
public $options = [
|
||||
'type' => 'image'
|
||||
];
|
||||
|
||||
protected function script()
|
||||
{
|
||||
$options = json_encode($this->options);
|
||||
|
||||
return <<<SCRIPT
|
||||
$('.grid-popup-link').magnificPopup($options);
|
||||
SCRIPT;
|
||||
}
|
||||
|
||||
public function zooming()
|
||||
{
|
||||
$this->options = array_merge($this->options, [
|
||||
'mainClass' => 'mfp-with-zoom',
|
||||
'zoom' => [
|
||||
'enabled' => true,
|
||||
'duration' => 300,
|
||||
'easing' => 'ease-in-out',
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function display(array $options = [])
|
||||
{
|
||||
if (empty($this->value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->value instanceof Arrayable) {
|
||||
$this->value = $this->value->toArray();
|
||||
}
|
||||
|
||||
$server = array_get($options, 'server');
|
||||
$width = array_get($options, 'width', 200);
|
||||
$height = array_get($options, 'height', 200);
|
||||
$class = array_get($options, 'class', 'thumbnail');
|
||||
$class = collect((array)$class)->map(function ($item) {
|
||||
return 'img-'. $item;
|
||||
})->implode(' ');
|
||||
|
||||
if (array_get($options, 'zooming')) {
|
||||
$this->zooming();
|
||||
}
|
||||
|
||||
Admin::script($this->script());
|
||||
|
||||
return collect((array)$this->value)->filter()->map(function ($path) use ($server, $width, $height, $class) {
|
||||
if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) {
|
||||
$src = $path;
|
||||
} elseif ($server) {
|
||||
$src = rtrim($server, '/') . '/' . ltrim($path, '/');
|
||||
} else {
|
||||
$src = Storage::disk(config('admin.upload.disk'))->url($path);
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<a href="$src" class="grid-popup-link">
|
||||
<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img {$class}' />
|
||||
</a>
|
||||
HTML;
|
||||
})->implode(' ');
|
||||
}
|
||||
}
|
||||
36
vendor/laravel-admin-ext/grid-lightbox/src/LightboxServiceProvider.php
vendored
Normal file
36
vendor/laravel-admin-ext/grid-lightbox/src/LightboxServiceProvider.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\Grid\Lightbox;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Grid\Column;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LightboxServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function boot(Lightbox $extension)
|
||||
{
|
||||
if (! Lightbox::boot()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if ($this->app->runningInConsole() && $assets = $extension->assets()) {
|
||||
$this->publishes(
|
||||
[$assets => public_path('vendor/laravel-admin-ext/grid-lightbox')],
|
||||
'laravel-admin-grid-lightbox'
|
||||
);
|
||||
}
|
||||
|
||||
Admin::booting(function () {
|
||||
|
||||
Admin::css('vendor/laravel-admin-ext/grid-lightbox/magnific-popup.css');
|
||||
Admin::js('vendor/laravel-admin-ext/grid-lightbox/jquery.magnific-popup.min.js');
|
||||
|
||||
Column::extend('lightbox', LightboxDisplayer::class);
|
||||
Column::extend('gallery', GalleryDisplayer::class);
|
||||
});
|
||||
}
|
||||
}
|
||||
7
vendor/laravel-admin-ext/wang-editor/.gitignore
vendored
Normal file
7
vendor/laravel-admin-ext/wang-editor/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
phpunit.phar
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
*.project
|
||||
.idea/
|
||||
20
vendor/laravel-admin-ext/wang-editor/LICENSE
vendored
Normal file
20
vendor/laravel-admin-ext/wang-editor/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jens Segers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
65
vendor/laravel-admin-ext/wang-editor/README.md
vendored
Normal file
65
vendor/laravel-admin-ext/wang-editor/README.md
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
wangEditor extension for laravel-admin
|
||||
======
|
||||
|
||||
这是一个`laravel-admin`扩展,用来将`wangEditor`集成进`laravel-admin`的表单中
|
||||
|
||||
## 截图
|
||||
|
||||

|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
composer require laravel-admin-ext/wang-editor
|
||||
```
|
||||
|
||||
然后
|
||||
```bash
|
||||
php artisan vendor:publish --tag=laravel-admin-wangEditor
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
在`config/admin.php`文件的`extensions`,加上属于这个扩展的一些配置
|
||||
```php
|
||||
|
||||
'extensions' => [
|
||||
|
||||
'wang-editor' => [
|
||||
|
||||
// 如果要关掉这个扩展,设置为false
|
||||
'enable' => true,
|
||||
|
||||
// 编辑器的配置
|
||||
'config' => [
|
||||
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
编辑器的配置可以到[wangEditor文档](https://www.kancloud.cn/wangfupeng/wangeditor3/335776)找到,比如配置上传图片的地址[上传图片](https://www.kancloud.cn/wangfupeng/wangeditor3/335782)
|
||||
|
||||
```php
|
||||
'config' => [
|
||||
'uploadImgServer' => '/upload'
|
||||
]
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
在form表单中使用它:
|
||||
```php
|
||||
$form->editor('content');
|
||||
```
|
||||
|
||||
## 支持
|
||||
|
||||
如果觉得这个项目帮你节约了时间,不妨支持一下;)
|
||||
|
||||

|
||||
|
||||
License
|
||||
------------
|
||||
Licensed under [The MIT License (MIT)](LICENSE).
|
||||
33
vendor/laravel-admin-ext/wang-editor/composer.json
vendored
Normal file
33
vendor/laravel-admin-ext/wang-editor/composer.json
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "laravel-admin-ext/wang-editor",
|
||||
"description": "wangEditor extension for laravel-admin",
|
||||
"type": "library",
|
||||
"keywords": ["laravel-admin", "extension", "editor"],
|
||||
"homepage": "https://github.com/laravel-admin-extensions/wangEditor",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "song",
|
||||
"email": "zosong@126.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"encore/laravel-admin": "~1.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~6.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Encore\\WangEditor\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Encore\\WangEditor\\WangEditorServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/fonts/w-e-icon.woff
vendored
Normal file
BIN
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/fonts/w-e-icon.woff
vendored
Normal file
Binary file not shown.
410
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.css
vendored
Normal file
410
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4220
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.js
vendored
Normal file
4220
vendor/laravel-admin-ext/wang-editor/resources/assets/wangEditor-3.0.10/release/wangEditor.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
vendor/laravel-admin-ext/wang-editor/resources/views/editor.blade.php
vendored
Normal file
18
vendor/laravel-admin-ext/wang-editor/resources/views/editor.blade.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="{{$viewClass['form-group']}} {!! !$errors->has($errorKey) ? '' : 'has-error' !!}">
|
||||
|
||||
<label for="{{$id}}" class="{{$viewClass['label']}} control-label">{{$label}}</label>
|
||||
|
||||
<div class="{{$viewClass['field']}}">
|
||||
|
||||
@include('admin::form.error')
|
||||
|
||||
<div id="{{$id}}" style="width: 100%; height: 100%;">
|
||||
<p>{!! old($column, $value) !!}</p>
|
||||
</div>
|
||||
|
||||
<input id="input-{{$id}}" type="hidden" name="{{$name}}" value="{{ old($column, $value) }}" />
|
||||
|
||||
@include('admin::form.help-block')
|
||||
|
||||
</div>
|
||||
</div>
|
||||
56
vendor/laravel-admin-ext/wang-editor/src/Editor.php
vendored
Normal file
56
vendor/laravel-admin-ext/wang-editor/src/Editor.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\WangEditor;
|
||||
|
||||
use Encore\Admin\Form\Field;
|
||||
|
||||
class Editor extends Field
|
||||
{
|
||||
protected $view = 'laravel-admin-wangEditor::editor';
|
||||
|
||||
protected static $css = [
|
||||
'vendor/laravel-admin-ext/wang-editor/wangEditor-3.0.10/release/wangEditor.css',
|
||||
];
|
||||
|
||||
protected static $js = [
|
||||
'vendor/laravel-admin-ext/wang-editor/wangEditor-3.0.10/release/wangEditor.js',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$id = $this->formatName($this->id);
|
||||
|
||||
$config = (array) WangEditor::config('config');
|
||||
|
||||
$config = json_encode(array_merge([
|
||||
'zIndex' => 0,
|
||||
'uploadImgShowBase64' => true,
|
||||
], $config, $this->options));
|
||||
|
||||
$token = csrf_token();
|
||||
|
||||
$this->script = <<<EOT
|
||||
(function ($) {
|
||||
|
||||
if ($('#{$this->id}').attr('initialized')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#{$this->id}');
|
||||
|
||||
editor.customConfig.uploadImgParams = {_token: '$token'}
|
||||
|
||||
Object.assign(editor.customConfig, {$config})
|
||||
|
||||
editor.customConfig.onchange = function (html) {
|
||||
$('#input-$id').val(html);
|
||||
}
|
||||
editor.create();
|
||||
|
||||
$('#{$this->id}').attr('initialized', 1);
|
||||
})(jQuery);
|
||||
EOT;
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
14
vendor/laravel-admin-ext/wang-editor/src/WangEditor.php
vendored
Normal file
14
vendor/laravel-admin-ext/wang-editor/src/WangEditor.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\WangEditor;
|
||||
|
||||
use Encore\Admin\Extension;
|
||||
|
||||
class WangEditor extends Extension
|
||||
{
|
||||
public $name = 'wang-editor';
|
||||
|
||||
public $views = __DIR__.'/../resources/views';
|
||||
|
||||
public $assets = __DIR__.'/../resources/assets';
|
||||
}
|
||||
35
vendor/laravel-admin-ext/wang-editor/src/WangEditorServiceProvider.php
vendored
Normal file
35
vendor/laravel-admin-ext/wang-editor/src/WangEditorServiceProvider.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Encore\WangEditor;
|
||||
|
||||
use Encore\Admin\Admin;
|
||||
use Encore\Admin\Form;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class WangEditorServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function boot(WangEditor $extension)
|
||||
{
|
||||
if (! WangEditor::boot()) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if ($views = $extension->views()) {
|
||||
$this->loadViewsFrom($views, 'laravel-admin-wangEditor');
|
||||
}
|
||||
|
||||
if ($this->app->runningInConsole() && $assets = $extension->assets()) {
|
||||
$this->publishes(
|
||||
[$assets => public_path('vendor/laravel-admin-ext/wang-editor')],
|
||||
'laravel-admin-wangEditor'
|
||||
);
|
||||
}
|
||||
|
||||
Admin::booting(function () {
|
||||
Form::extend('editor', Editor::class);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user