Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laravel-admin-extensions/file-browser
A Simple File Browser Extension For Laravel-Admin
https://github.com/laravel-admin-extensions/file-browser
Last synced: about 1 month ago
JSON representation
A Simple File Browser Extension For Laravel-Admin
- Host: GitHub
- URL: https://github.com/laravel-admin-extensions/file-browser
- Owner: laravel-admin-extensions
- License: mit
- Created: 2018-11-07T06:23:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-01T04:14:59.000Z (almost 6 years ago)
- Last Synced: 2024-11-02T18:41:32.380Z (about 1 month ago)
- Language: HTML
- Size: 185 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-laravel-admin - file-browser - 一个简单的文件浏览扩展 (扩展包 / 工具类扩展包)
README
File-browser
======
a simple file browser extension for laravel-admin一个简单的文件浏览扩展
本扩展包是基于[media-manager](https://github.com/laravel-admin-extensions/media-manager)的一个目录文件查看工具,可以直接用于Form表单。
版本为laravel-admin 1.61,安装:
````
composer require laravel-admin-ext/file-browser
````2,发布media-manager的文件(如已发布,可跳过)
````
php artisan admin:import media-manager
````3,配置`config/admin.php`文件的(本扩展共用media-manager的配置)
````
'extensions' => ['media-manager' => [
// Select a local disk that you configured in `config/filesystem.php`
'disk' => 'public'
],
],````
4,注册进laravel-admin,在app/Admin/bootstrap.php中添加以下代码:
````
Encore\Admin\Form::extend('media', \Encore\FileBrowser\FileBrowserField::class);
````5,直接调用就可以了,path选项可以指定目录,否则将使用默认根目录。
````
$form->media('ColumnName', 'LabelName')->path('uploads');$form->media('ColumnName', 'LabelName')->path('uploads/images');
````
注意:
---
1,本扩展不支持识别目录(即文件夹),仅识别path设定的一级目录下的所有文件;
2,本扩展默认可多选,字段存为json字符串,模型文件需添加如下修改器:
```
public function getImagesAttribute($v)
{
return json_decode($v, true);
}
```
效果如图:默认:![](default.png)
选择:![](select.png)
选中:![](selected.png)