- BETA version changelog
- v2.2.0-beta
- v2.1.7-beta
- v2.1.6-beta
- v2.1.5-beta
- v2.1.3-beta
- v2.1.2-beta
- v2.1.1-beta
- v2.1.0-beta
- v2.0.24-beta
- v2.0.23-beta
- v2.0.22-beta
- v2.0.21-beta
- v2.0.20-beta
- v2.0.19-beta
- v2.0.18-beta
- v2.0.17-beta
- v2.0.16-beta
- v2.0.15-beta
- v2.0.14-beta
- v2.0.13-beta
- v2.0.12-beta
- v2.0.11-beta
- v2.0.10-beta
- v2.0.9-beta
- v2.0.8-beta
- v2.0.7-beta
- v2.0.6-beta
- v2.0.5-beta
- v2.0.4-beta
- v2.0.3-beta
- v2.0.2-beta
- v2.0.1-beta
BETA version changelog
v2.2.0-beta
Release date 2022/2/20
To upgrade, run the following commands step by step, and finally clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.2.0-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
New features
1. Added support for Laravel version 9.x
2. Support for using table
forms in hasMany
and array
forms
Use the following
$form->array($field, function ($form) {
$form->table('table_json', function ($form) {
$form->text('title');
...
});
});
3. Data table filter add findInSet method
#1639 @guanguans sql: ... WHERE FIND_IN_SET("$input", $column)
, example
$grid->filter(function ($filter) {
$filter->findInSet($field);
});
4. Tweak code generator to select default directory logic
#1627 @Edwin The new version will use the directory set by the configuration parameter admin.directory
as the default directory, which is Admin
by default.
BUG FIXES
- fix the problem that
table
form does not supporthelp
method #1616 @jcbt - repair the problem that the default application home page is inaccessible when registering extension route after enabling multiple applications
- fix the problem of not being able to hide the reset button of pop-up form #1631 @Sparkinzy
- fix
autocomplete
error reported by js component when the field value is digital #1661 @Sparkinzy - fix the problem that permission management form can’t read routing information when setting route prefix as “/“
v2.1.7-beta
Release date 2021/12/25
To upgrade, execute the following commands step by step, and finally clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.7-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
New features
1. Add admin_redirect
function
This function can be used instead of the redirect
function to support pjax
and ajax
requests
// no need to add the admin prefix
return admin_redirect('auth/users');
// If you want to jump to a link that is not prefixed with admin, you need to pass the full url link
return admin_redirect(url('users'));
BUG FIX
- fix
destroyThumbnail
problem when using file upload form to delete files - fix the problem that row data cannot be deleted when
hasMany
/array
/table
form field name is the same as subform field name
v2.1.6-beta
Release date 2021/12/12
To upgrade, run the following commands step by step, and finally clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.6-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
New features
1. Add Form::autocomplete()
form
#1514 @Edwin This form allows you to search for form values while filling out the form and display the results in a dropdown list, using the following
$form->autocomplete($column[, $label])->options(['foo', 'bar', ...]) ;
It is also possible to get data from the remote API
// the first parameter of the ajax function is the ajax url, the second parameter is the valueField (optional), and the third parameter is the groupField (optional)
$form->autocomplete($column[, $label])->ajax('/countries', 'name', 'region');
The remote API server-side request parameter is query, and the sample code is as follows
class CountryController extends AdminController
{
public function search()
{
$countries = Country::when(request('query'), function ($query, $value) {
$query->where('name', 'like', "%{$value}%");
})->get();
return Admin::json($countries->toArray());
}
}
For more usage refer to the document Data Forms - Field Usage - autocomplete
2. Image/file upload support for arttribute
method
#1510 @iwzh The attribute
method allows you to set attributes to a hidden field form for file uploads, used as follows
$form->file($column)->attribute(['foo' => 'bar', ...]) ;
3. Add between
table header filter to data table
#1510 @iwzh is used as follows
$grid->column('created_at')->filter(
Grid\Column\Filter\Between::make()->datetime()
);
4. Add depthColumn
to the model tree to save the current hierarchy
Use the following
class Category extends Model
{
use ModelTree;
// Defining the depthColumn property will save the current row's hierarchy in the data table
protected $depthColumn = 'depth';
}
5. Form Row
layout can be set independently of width
#1530 @iwzh is used as follows
$form->row(function ($row) {
// Set the default width for all fields
$row->defaultWidth(3);
// Set the width of each field independently
$row->width(4)->text(...) ;
});
Functional improvements
1. Adjust the parameter type accepted by the rows method callback function when exporting data from a data table to Collection #1584 @jourdon is used as follows
use Illuminate\Support\Collection;
$grid->export()->rows(function (Collection $rows) {
foreach ($rows as $index => &$row) {
// The format of $row is the model
dd($row);
}
return $rows;
});
BUG FIXES
- fix the problem of uploading image thumbnails with OSS #1499 @jorry2008
- fix the problem that the default item of data table filter cannot be set to
0
#1506 @liushoukun - repair the problem of abnormal validation rules of one-to-one correlation form #1516
- fix the problem that when uploading form files, you can’t continue to drag and drop the files if they have been added #1541 @hmilyfyj
- fix the problem of style loss when paginator is switched under
LazyRenderable
#1539 @jyiL - fix the problem of wrong data type of paging
perPage
when using MongoDB for data table #1555 @SmallRuralDog - fix the problem that
pjax
can’t initializea
tag again after the page is rendered withpjax
#1576 @xyzzxy123 - fix the invalid parameter of
refresh
ofColumn::switch()
method of data table #1595 @wxfjamdc - fix the problem that uploading multiple pictures will cause the old picture thumbnails to be deleted #1556
v2.1.5-beta
Release date 2021/9/16
To upgrade, execute the following commands step by step, and finally clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.4-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
BUG FIXES
- fix the problem that the pop-up window of admin list is empty when you click to view permission
- fix the problem that
non-equal
query for the fields in the data table is not effective - repair the problem that the original field value cannot be obtained in
displayer
after usingif
method for data tablecolumn
.
v2.1.3-beta
Release date 2021/9/14
To upgrade, run the following commands step by step, and finally clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.3-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
Functional improvements
1. Refactored in-line editing of data tables
The current version refactored the UI
style of the in-line edit form for editable
, checkbox
and radio
to show the form in a popup window. And a new in-line editing form textarea
has been added, with the following effect.
2. Add favicon
parameter to configuration file
From the current version, you can configure favicon
link in config/admin.php
with the parameter favicon
.
3. Support displaying the message
of exceptions thrown when submitting data forms
As of the current version, if an exception is thrown when submitting a form, it will look like this
$form->submitted(function ($form) {
throw new \Exception('Access forbidden');
});
Then you will see the following message in the page
5. Optimize the use of array
and table
forms in tool forms
In the old version of Widgtet/Form
, if you use array
and table
forms, and if you use file upload form in array
and table
forms, you need to customize the file upload address in order to upload properly, so this version has optimized this function, and after the updated version, you don’t need to customize the upload address anymore.
$this->array('...' , function ($form) {
// No need to customize the upload address
$form->image('img');
});
4. Add support for addElementClass
method on data form html
In the old version, the class
set by addElementClass
did not work for the html
method, so this has been improved in the new version
$form->html(...) ->addElementClass(['class1', ...]) ;
5. Data form image upload form does not check if image exists when accessing thumbnails
BUG FIXES
- fix the problem that data forms cannot be merged correctly when using closure validation rules #1429 @Edwin
- fix the problem that the file name generated after the
sequenceName
method is enabled for file upload has a duplicate suffix - repair the problem that files cannot be uploaded after setting
required
validation rules for one-to-one fields in file upload form - repair the problem of blank filtering sidebar under some operations #1445 @Abbotton
- fix the problem of invalid second parameter specified in
model
method ofselectTable
,multipleSelectTable
and other fields #1460 @hhniao - fix the problem of not being able to translate the text of
dimensions
verification failure prompt in the image upload form - fix the problem that the picture upload form cannot be submitted after using picture upload form in
array
,table
andhasMany
forms and settingdimensions
validation rules - repair the problem that only the first picture can be previewed in multi-picture upload
- repair the problem that the dynamic display of the form does not take effect if the field value has decimal point
v2.1.2-beta
Release date 2021/7/12
To upgrade, step-by-step execute the following commands and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.2-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
Feature improvements
1. Add Grid\Model::apply() method
This method can be used to apply quick search and filtering query criteria to a data table.
In the old version, it was very troublesome to use the quick search and filtering query criteria
$grid->header(function ($collection) use ($grid) {
$query = Model::query();
// Get the table filter where condition array to iterate through
$grid->model()->getQueries()->unique()->each(function ($value) use (&$query) {
if (in_array($value['method'], ['paginate', 'get', 'orderBy', 'orderByDesc'], true)) {
return;
}
$query = call_user_func_array([$query, $value['method']], $value['arguments'] ? []);
});
// Find out the statistics
$data = $query->get();
// Customize the component
return new Card($data);
});
Starting with the current version you can use the apply
method to simplify the above code
$grid->header(function ($collection) use ($grid) {
$query = Model::query();
// Get the table filter where condition array to iterate through
$grid->model()->apply($query);
// Find out the statistics
$data = $query->get();
// Customize the component
return new Card($data);
});
BUG FIXES
- fix the problem that data form can’t disable bulk delete button
- fix the problem that Gaode map form does not zoom when it has coordinates #1377 @gzxy-0102
- repair the problem that the download button of file upload form is not displayed #1405
- fix the problem of data filtering parameters not taking effect after using
simplePaginate
in data table #1405
v2.1.1-beta
Release date 2021/7/12
To upgrade, execute the following commands step by step and clear your browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.1.1-beta"
php artisan admin:update # The translation files menu.php and global.php will not be overwritten
New features
1. Add model tree expand method to control whether to expand all child node data
Expand all child node data by default
// Expand the child node data
$tree->expand();
// Collapse all child node data
$tree->expand(false);
2. Add file upload form download function
$form->file('...')->downloadable();
3. Add the Gaudet map form
Set in the configuration file config/admin.php
#1331 @gaizhixin
'map' => [
'provider' => 'amap',
'keys' => [
// Configure the key of Gaode Map
'amap' => 'key',
],
],
4. New addElementClass method for setting custom classes to form fields
// If you don't want to add a prefix, set the second parameter to false
$form->text(...)->addElementClass(['class1', 'class2'], false);
5. Add table batch operation to set the drop-down menu split line function
Support the following two ways
// Way 1
$grid->batchActions(function ($batch) {
$batch->add(...);
// Show split line
$batch->divider();
...
});
// Way 2
use Dcat\Admin\Grid\Tools\ActionDivider;
$grid->batchActions([
new Action1(),
...
new ActionDivider(),
...
]);
Feature improvements
1.table form support custom view
$this->table(...)->setView('...');
2. Optimize the operation experience and UI after menu shrinkage
When the menu shrinks, the cursor moves up and automatically expands if the menu is clicked, it will automatically shrink back after jumping; and fixes the problem of mini-logo
being shown incorrectly.
3. Data table row action column no longer shows empty dropdown menu when there is no action button
Data table row action column no longer shows empty dropdown menu when there is no action button #1327 @jiangyuntao
4. Optimize display of image upload form images
BUG FIXES
- repair the problem that
Grid::__toString()
will report an error if there is no data when the tree table (tree
) expands its sub-nodes - repair the problem of invalid filtering conditions reduction after enabling asynchronous rendering function of data table
- repair the problem of abnormal display of the number of filtering items in asynchronous rendering of the table
- repair the problem that setting
class
of form fields will overwrite the defaultclass
. - repair the problem of displaying abnormal messages when visiting the page without authority after closing
debug
mode - repair the problem that
Grid::disableBatchDelete
fails after the configuration file custom batch delete button - repair the problem that tertiary menu cannot be hidden after menu indentation
- repair the problem that the built-in permission system reports error when clicking
Add permission
when it is set to no route prefix - repair the problem of not disabling the authority middleware when the built-in authority system is disabled.
- repair the problem that editing data cannot be displayed when the second parameter of
select
andmodel
ofselectTable
is notid
. - fix the problem that some forms setting size style does not take effect #1361 @Abbotton
- fix the problem that the table sorting function is not compatible with
Grid\Model::latest
andoldest
methods
v2.1.0-beta
Release date 2021/5/23
To upgrade, step-by-step execute the following commands and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.1.0-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
New features
1. Add table asynchronous rendering feature
When the table on a page displays a particularly large amount of data (many columns and many rows) and loads more components, it may lag, so you can use the table asynchronous rendering feature to effectively reduce the page lag: the
// Enable asynchronous rendering of tables
$grid->async();
Note that there is no need to enable this feature if the page is not visibly stuttering, and that it is not available if there are multiple data tables on the page! Refer to datagrid - asynchronous rendering for detailed usage
Feature improvements
1. Support for Laravel Octane 1.x
version
This version adapts the changes related to Laravel Octane 1.x
version, refer to Laravel Octane for the specific usage.
2. Call expand(false)
to disable automatic pop-up filter sidebar
// disable automatic popup filter sidebar
$grid->filter(function ($filter) {
$filter->expand(false);
...
});
3. Upgrade tinymce
to v5.8.0
version
4. Automatically clear the menu cache after binding the menu to the permissions and roles pages
BUG FIXES
- fix
withConstraints
method invalid for detail pageurl
problem #1232 - fix the problem that the form value is converted into an associated array when the multi-image/file upload form deletes pictures
- fix the problem that Baidu map component cannot be used after
https
is enabled #1162
v2.0.24-beta
Release date 2021/4/30
To upgrade, step-by-step execute the following command and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.24-beta"
php artisan admin:update # will not overwrite the translation files menu.php and global.php
New features
1. Add the ability to bind menus directly when creating or editing roles and permissions
This feature is enabled by default and can be disabled by configuring the parameters admin.menu.role_bind_menu
and admin.menu.permission_bind_menu
, the effect is as follows
2. New Form\Tree::treeStatus()
method to allow separate parent node selection
Usage
$form->tree('xxx')
->treeState(false) # allow separate parent selection
->setTitleColumn('title')
->nodes(...) ;
BUG FIX
- fix the problem of not being able to use domain name to distinguish applications in case of multiple applications
- fix the problem that
Admin::pjax()
method is not declared asstatic
. - repair the problem that only a single option takes effect after
grid filter checkbox
can only select multiple options @outer199 - fix the problem that the default icon setting of menu is invalid
- repair the problem of error when using
embeds
form inphp7.4
or above #1204 - fix the problem of using `$form->list(…)’ under step-by-step form ->limit(…) Refresh the page with error after the parameter check does not pass #1206
- fix the problem of not being able to jump after editing and creating after disabling
pjax
#1208
v2.0.23-beta
Released on 2021/4/18
To upgrade, execute the following commands step by step and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.23-beta"
php artisan admin:update
New features
1. Add support for Laravel Octane
Laravel Octane is a Swoole/RoadRunner
driven project that can improve the performance of the Laravel
framework, after installation it can significantly improve the performance of Laravel
projects, Dcat Admin
is also compatible with the Laravel Octane
environment, just add the following configuration to the configuration file config/octane.php
.
'listeners' => [
... ,
RequestReceived::class => [
... .Octane::prepareApplicationForNextOperation(),
... .Octane::prepareApplicationForNextRequest(),
// Enable support for Dcat Admin
Dcat\Admin\Octane\Listeners\FlushAdminState::class,
class],
...
],
Laravel Octane is still in
beta
phase, for installation and more information about Laravel Octane Please go to the documentation at https://github.com/laravel/octane for more information.
2. Add simplePaginate
feature to tables
Enabling simplePaginate
function will use Laravel
‘s simplePaginate function for pagination, which can greatly improve the page response speed when the data volume is large. However, it is important to note that the total rows of the data table will not be queried after using this feature.
// Enable
$grid->simplePaginate();
// Disable
$grid->simplePaginate(false);
Functional improvements
1. Refactor translation function
In past versions, the field names could not be translated automatically when using the asynchronous forms and asynchronous forms functions, but from the current version onwards you can specify the path to the translation file for automatic translation using the `translation
‘’ attribute, as follows
<?php
namespace App\Admin\Forms;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
class MyForm extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Specify the translation file name
*
* @var string
*/
protected $translation = 'my-form';
public function form()
{
$this->text('field1');
$this->text('field2');
...
}
...
}
The language package resources/lang/{locale}/my-form.php
has the following contents
<?php
return [
'fields' => [
'field1' => 'field1',
'field2' => 'field2',
...
],
];
And you can also specify the path to the current translation file in the controller
use Dcat\Admin\Http\Controllers\AdminController;
class UserController extends AdminController
{
/**
* Specify the name of the translation file
*
* @var string
*/
protected $translation = 'user1';
...
}
Of course it can also be specified via the Admin::translation()
method
use Dcat\Admin\Admin;
Admin::translation('user');
2. Add form-related configuration parameters
Add several form-related configuration file parameters admin.grid.*
:
'grid' => [
// table row action class
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
// Grid batch action class
'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class,
// Table paginator class
'paginator_class' => Dcat\Admin\Grid\Tools\Paginator::class,
// The default configuration of several action classes for the grid row
'actions' => [
'view' => Dcat\Admin\Grid\Actions\Show::class,
'edit' => Dcat\Admin\Grid\Actions\Edit::class,
'quick_edit' => Dcat\Admin\Grid\Actions\QuickEdit::class,
'delete' => Dcat\Admin\Grid\Actions\Delete::class,
'batch_delete' => Dcat\Admin\Grid\Tools\BatchDelete::class,
],
...
],
3. Remove display of table footer information after disabling table paging
Starting from the current version, the table footer information will no longer be displayed if paging of the table is disabled.
4. Optimize Filter::panel()
layout spacing
5. Optimize the file publishing function, the menu.php
and global.php
files will no longer be overwritten when publishing language pack files
Starting from the current version, the menu.php
and global.php
files are no longer overwritten when using the admin:update
and admin:publish --force
command files.
6. Update Tinymce
version to 5.6.2
BUG FIXES
- fix the problem of error when field type is
Object
in data table @xiaohuilam - fix the problem that file upload fails and still prompts successful upload
- repair the problem of not using the incoming
$request
object when matching the middleware of permission judgment @asmodai1985 - fix the problem of invalid setting
message
for the second parameter ofrules
method of the form - fix the problem that
Helper::array()
converts0
to an empty array - fix the problem that the row selector cannot select sub-level rows of tree table
- Fix the problem that `KeyValue::setValueLabe
- fix the problem that
hasmany
andtable
form resets the form when deleting options - fix the problem of displaying wrong text of edit button for table row operation @GemaDynamic
- fix the problem that sub-level rows of tree table can’t use form pop-up window properly #813
v2.0.22-beta
Release date 2021/4/1
To upgrade, step-by-step execute the following command and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.22-beta"
php artisan admin:update
BUG FIXES
- repair some functions missing
CSRF_TOKEN
error problem - fix the error reported by menu auto-adaptation height function
v2.0.21-beta
Release date 2021/3/30
To upgrade, step-by-step execute the following commands and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.21-beta"
php artisan admin:update
New features
1. Add table column selector ColumnSelector
to support persistent storage
In the configuration file config/admin.php
you can configure the way to store the state of the column selector, the supported storage methods are as follows
Dcat\Admin\Grid\ColumnSelector\SessionStore
ColumnSelector state data is stored insession
, only valid in the login stateDcat\Admin\Grid\ColumnSelector\CacheStore
Column selector state data is stored in Laravel Cache cache system for up to300
days and can be configured withadmin.grid.column_selector.store_params.driver
which defaults tofile
'grid' => [
...
'column_selector' => [
'store' => Dcat\Admin\Grid\ColumnSelector\SessionStore::class,
'store_params' => [
'driver' => 'file',
],
],
],
2. Add an end method (end
) to the form conditional judgment (if
)
$grid->column('status')
->if(...) // Condition 1
->display(...)
->display(...)
->if(...) // condition 2
->display(...)
->display(...)
->end() // end the previous condition
->display(...) ; // All conditions are valid
3. Add the default check (check
) and disable (disable
) functions of the table row selector
The check
method can be used to set the default selected rows, this method accepts an array
type or an anonymous function
parameter
// Set the default check for rows 1/3/5
$grid->rowSelector()->check([0, 2, 4]);
// Pass the closure
$grid->rowSelector()->check(function () {
// set the default to check rows 1/3/5
return in_array($this->_index, [0, 2, 4]);
});
// Use other fields of the current row in the closure
$grid->rowSelector()->check(function () {
// set the default to check rows with id > 10
return $this->id > 10;
});
The disable
method allows you to set the rows that are not allowed to change their check status, this method accepts an array
type or an anonymous function
parameter
// Disable row 1/3/5 from being selected
$grid->rowSelector()->disable([0, 2, 4]);
// Pass the closure
$grid->rowSelector()->disable(function () {
// disable row 1/3/5 from changing selection status
return in_array($this->_index, [0, 2, 4]);
});
// Use other fields of the current row in the closure
$grid->rowSelector()->disable(function () {
// disable the selected state for rows with id > 10
return $this->id > 10;
});
// disable can be used in conjunction with the check method
$grid->rowSelector()->check([2, 4])->disable([0, 2, 4]);
4. Add KeyValue
form custom title translation function
$form->keyValue(...) ->setKeyLabel('keyName')->setValueLabel('keyValue');
5. Add Grid::scrollbarX
method to show horizontal scrollbar of table
Show the horizontal scrollbar of the grid, not by default
// Enable
$grid->scrollbarX();
// Disable
$grid->scrollbarX(false);
6. Add admin:update
command
Starting from the current version, you can run admin:update
directly after upgrading, which is equivalent to running
php artisan admin:publish --assets --migrations --lang --force
php artisan migrate
Feature improvements
1. Form display is compatible with hump style association names when editing data
In the old version, if you need to edit a model association field and the model association name is hump style, you need to change the name to underscore style to display it properly, which is very unfriendly to developers. Starting from the current version, you can use the hump style association names directly without any special handling
return Form::make(User::with(['myProfile']), function (Form $form) {
// Directly use camel style naming, no need to do anything else
$form->text('myProfile.full_name');
...
});
2. Adjust the tool form data setting logic to get default
method data in the form
method
use Dcat\Admin\Widgets\Form;
class Setting extends Form
{
public function form()
{
// 获取 default 方法设置的数据
$id = $this->data()->id;
$name = $this->data()->name;
$this->text('name');
...
}
public function default()
{
return [
'id' => 1,
'name' => 'abc',
...
];
}
}
3.hasMany
and array
forms support overall validation using rules
validation rules
$form->hasMany(...) ->rules('size:2');
4. Adjust the default placeholder for selectTable
to select ...
5. Optimize form row layout spacing
BUG
- fix the problem that
ModelTree
can’t delete the child nodes with more than one level of interval when deleting nodes - repair the problem that the export function may be abnormal in some environments
- repair the problem that the initial value of form linkage (
load
) is lost after loading @xqbumu - repair the problem of abnormal display of prompt information after file upload failure
- repair the problem of incorrect primary key assignment if the data details
Show
instantiation function passes the model @jisuye - fix the problem that the table
setConstraints
method is invalid for quick editing #1119 - fix the problem of abnormal preview image function in
iframe
page - fix the problem that the form cannot be submitted after the fields with
required
validation rules are deleted inhasMany
andarray
forms - fix the abnormal loading problem of table
dialogTree
when the top ID is string0
#1122
v2.0.20-beta
Release date 2021/3/8
To upgrade, step-by-step execute the following commands and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.20-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Feature improvements
1. selectTable
form retains the data state of the previous page when the form is refreshed
selectTable
form will retain the selected or unselected data state of the previous page after refreshing or paging
2. selectTable
form set display field name optimization
In the old version, if you want to set the selected or displayed fields of selectTable
form, you need to set them in the Renderable
object, which is very troublesome and inconvenient, from the current version, developers can set the selected or displayed fields directly by the following method
$form->selectTabole('user_id')
->from(UserTable::make())
->pluck('full_name', 'id'); // the first parameter is the field to be displayed, the second parameter is the field that will be saved to the form when selected
// You can also use the following method directly
$form->selectTabole('user_id')
->from(UserTable::make())
->model(UserModel::class, 'id', 'full_name');
3.selectTable
, multiSelectTable
, radio
, checkbox
forms add load
method
Starting from the current version, selectTable
, multipleSelectTable
, radio
, checkbox
can also link select
and multipleSelect
forms using the load
method
$form->radio('type')->options([...]) ->load('category', 'categories/options');
$form->select('categories');
The interface categories/options
returns the following format
[
{
"id": 9,
"text": "xxx"
},
{
"id": 21,
"text": "xxx"
},
...
]
4. Add menu horizontal layout automatically adapt to the page and the menu height change function
Enable the menu horizontal layout function, when the page height or menu height changes, the page will be self-adapting, self-adjusting content spacing
5. Add table Grid::dropColumn()
method to delete set columns
$nameColumn = $grid->column('name');
// Delete the column with the name `name`
$grid->dropColumn('name');
// Equivalent to
$grid->dropColumn($nameColumn);
6. Add the admin_javascript
function
This function can be used to add JS
code to the configuration array
of php
, with the following usage
$form->text('number')->inputmask([
'oncomplete' => admin_javascript('function () {
// Here is the js code
alert('inputmask complete');
}'),
]);
6.Form
form bottom can be checked by default View
, Continue editing
, Continue creating
and other option functions
Use the following #1073
$form->footer(function (Footer $footer) {
// set ``view`` to be selected by default
$footer->defaultViewChecked();
// set `Continue editing` to be checked by default
$footer->defaultEditingChecked();
// set `Continue creating` to be checked by default
$footer->defaultCreatingChecked();
});
// set `Viewing` to be checked by default
$form->defaultViewChecked();
// set `Continue editing` to be checked by default
$form->defaultEditingChecked();
// set `Continue creating` to be checked by default
$form->defaultCreatingChecked();
BUG
- fix the problem that the form must be sorted by
with
first when using the correlation field - repair the problem that multiple asynchronous components cannot be rendered at the same time on the same page
- repair the problem of abnormal jumping after deleting child node data under tree table #1071
- repair the abnormal export problem when there is an empty array in the export field of the table
- repair the problem that the picture element of the page disappears when using
sortable
function to sort the form multi-picture upload - repair the problem of invalid setting
false
fordisable
method of form fields - repair the problem that
multipleSelect
form cannot pass all selected options into the interface when usingload
linkage loading #1076 - fix the problem of abnormal selection function when there are multiple options starting with 0 in table specification selector
v2.0.19-beta
Release date 2021/2/21
To upgrade, step-by-step execute the following command and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.19-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
BUG FIXES
- fix
no access
problem when requestingbuilt-in api
in non-admin role - fix the problem of using time range form in popup window to report error
v2.0.18-beta
Released on 2021/2/20
To upgrade, run the following commands step by step and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.18-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Feature improvements
1. Add horizontal layout at the top of the menu (Horizontal)
Set the value of the configuration parameter admin.layout.horizontal_menu
to true
to enable this feature, the effect is as follows
Permission middleware and skip login judgment can fill in the route alias and do not need to increase the prefix
Configuration file and permission setting route alias without filling in the route prefix
'permission' => [
...
// Skip the permissions
'except' => [
// You can fill in the route alias directly, and you don't need to write the route prefix
'custom.users',
],
],
3. Add _index
field to save row number for data table row data
The _index
field is used to save the row number, starting from 0
, and is used as follows
// Use in the display callback
$grid->column('serial number')->display(function () {
return $this->_index + 1;
});
// used in a row action
$grid->actions(function ($actions) {
$index = $this->_index;
...
});
4. Rename markdown component static resource aliases to avoid conflicts with custom blade tags
5. Add configuration parameter admin.menu.default_icon
to set the default menu icon
admin.menu.default_icon
is used to set the default menu icon, the default value is feather icon-circle
6. Add new block locations NAVBAR_BEFORE
and NAVBAR_AFTER
use Dcat\Admin\Admin;
// Output content to the front of the top navigation bar
admin_inject_section(Admin::SECTION['NAVBAR_BEFORE'], view('...'));
// Output content after the top navigation bar
admin_inject_section(Admin::SECTION['NAVBAR_AFTER'], view('...'));
6. Optimize form field selector code
BUG FIXES
- fix the problem of abnormal display of
new
tag on the extension management page #1044 - fix the problem of error reported after successful file uploading and direct deletion #1058
- repair the abnormal input value problem of
Form::number
form after usingmin
andmax
methods
v2.0.17-beta
Release date 2021/2/5
To upgrade, step-by-step execute the following commands and clear the browser cache
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.17-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Function improvement
1. Optimize the table sorting function
Support orderBy
to sort directly using related table fields, note that only one to one
and one to many
related relationships are supported here
$grid->model()->orderBy('profile.age');
2. Add the function of customizing parent_id
value in the model tree and tree table
Model tree and tree table can be customized in model
with parent_id
value, the default value is 0
.
class Category extends Model
{
use ModelTree;
// Set the default parent_id to A
protected $defaultParentId = 'A';
}
3. Data details file
supports displaying multiple files
$show->field('...')->files();
Result
4.Form::input
supports array batch settings
$form->submitted(function ($form) {
$form->input(['k1' => 'v1', 'k2' => 'v2' ...]);
});
5. Extension management supports logo
and alternate display
Refer to the documentation extensions for detailed usage
6. Add admin_route method to get URL by alias
The app/Admin/routes.php
route is registered as follows
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
// Set alias
$router->resource('users', 'UserController', [
'names' => ['index' => 'my-users'],
]);
});
Get URL by alias
// Get the url
$url = admin_route('my-users');
// Determine the route
$isUsers = request()->routeIs(admin_route_name('users'));
JsonResponse::location allows not to pass parameters
The current page will be automatically refreshed after 1
seconds if no parameters are passed
return Admin::json()->success('operation successful')->location();
9.Page LayoutLayout\Column support equal width layout
Equal-width layout is used when the column width is set to 0
#1018
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Layout\Content;
return Content::make()
->body(function (Row $row) {
$row->column(0, view('...'));
});
10. The page layout Layout\Row supports no-gutters property
.row
with margin-left: -15px;margin-right: -15px;
attribute, you can eliminate this attribute by defining the .no-gutters
attribute on .row
so that the page is not 30px
extra wide, i.e. <div class="row no- gutters"...
$content->row(function (Row $row) {
// Enable no-gutters
$row->noGutters();
$row->column(9, function (Column $column) {
$column->row($this->card(['col-md-12', 20], '#4DB6AC'));
$column->row(function (Row $row) {
// Enable no-gutters
$row->noGutters();
$row->column(4, $this->card(['col-md-4', 30], '#80CBC4'));
$row->column(4, $this->card(['col-md-4', 30], '#4DB6AC'));
$row->column(4, function (Column $column) {
$column->row(function (Row $row) {
// Enable no-gutters
$row->noGutters();
$row->column(6, $this->card(['col-md-6', 30], '#26A69A'));
$row->column(6, $this->card(['col-md-6', 30], '#26A69A'));
});
});
});
});
});
The effect is as follows
11. Retain the get parameter of the URL after deleting data from the form
In the previous version, the get
parameter of the URL
was lost after deleting data, resulting in jumping back to the first page of the form. This version has optimized this feature, and the get
parameter of the URL
is still retained after deletion #961
12. Refactor file upload front-end code
This feature is a technical optimization, this version refactored the file upload front-end code, split the code to make it easier to read and maintain
BUG FIXES
- fix
MultipleSelect
form style exception problem #967 - fix the abnormal problem of using
select2
form after loadingmarkdown
component #990 - fix the problem of losing traditional Chinese file name saved under
Linux
server when uploading files #993 - fix the problem that
Widgets\Dropdown::click
cannot display default options - fix the problem of
NaN
when clicking the plus/minus button when the text content ofnumber
component inform
form is empty #995 - repair the problem that the picture preview fails to indicate that the translation file cannot be used
- repair the problem of abnormal judgment of
Range
form of one-to-one association relationship using validation rules - repair the problem of route alias conflict under multiple applications
v2.0.16-beta
Release date 2021/1/11
To upgrade, step-by-step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.16-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Breaking changes
1. Adjusted disableHorizontal
to horizontal
for form fields
Change the form field layout to horizontal
, this is enabled by default and is used as follows
// Disable the horizontal layout
$form->text('...')->horizontal(false);
Feature improvements
1. Enhance the sortable function of form fields
Make form fields support sortable for relational table fields and json
fields
Note that associative relationships only support
hasOne
andbelongsTo
types of field sorting, and do not support multiple levels of nesting!
// Sorting fields in the associated table
$grid->column('profile.age')->sortable();
// Specify the name of the field to be sorted
$grid->column('my_age')->sortable('profile.age');
// json field sorting
$grid->column('options.price')->sortable('options->price');
// Sort the json fields of the association table
$grid->column('profile.options.price')->sortable('profile.options->price');
Support MySql
order by cast(`{field}` as {type})
usage
$grid->column('profile.age')->sortable(null, 'SIGNED');
$grid->column('profile.options.price')->sortable('profile.options->price', 'SIGNED');
2. Add admin_exist function to replace exit
admin_exist
is used to interrupt the execution of the program and respond to the browser with data for display, instead of exit
and die
, the following is a brief description of usage
Usage 1, return Content
layout object, this usage can be used to return error messages to the front end
use Dcat\Admin\Widgets\Alert;
use Dcat\Admin\Layout\Content;
// Interrupt the program and display a custom page to the front end
admin_exit(
Content::make()
->title('title')
->description('description')
->body('Page content 1')
->body(Alert::make('Server error~', 'Error')->danger())
);
The effect is as follows
Usage 2, returning json
formatted data, often used for api
request interception for form submissions, or api
request interception for Action
use Dcat\Admin\Admin;
admin_exit(
Admin::json()
->success('succeeded')
->refresh()
->data([
...
])
);
// Of course you can also respond directly to the array
admin_exit([
...
]);
Usage 3, direct corresponding Response
object or string
admin_exit('Hello world');
admin_exit(response('Hello world', 500));
3. Add Show\Field::bool() and Show\Field::bold() methods
Show ✓
if the field value is true, otherwise show ✗
#940
$show->field('...')->bool();
Bolded field values
$show->field('...') ->bold();
// Specify the color
$show->field('...') ->bold(admin_color()->primary());
4. Add Form\Footer::view() method
The `Form\Footer::view()
method allows you to customize the bottom view of a data form #957
$form->footer(function ($footer) {
$footer->view('...' , [...]) ;
});
5. Add form default to show specified Tab function
// Show the Tab with the title Title 2 by default
$form->getTab()->active('Title2');
// You can also specify an offset
$form->getTab()->activeByIndex(1);
$form->tab('Heading 1', function ($form) {
...
});
$form->tab('Title2', function ($form) {
...
});
6. Add form Form\Row::horizontal() method
Set the layout to horizontal
$form->row(function (Form\Row $form) {
$form->horizontal();
...
});
7. Form Modal adds custom icon functionality
$grid->column('...') ->modal(function ($modal) {
// Custom icons
$modal->icon('feather icon-x');
return ... ;
});
8. Add route domain restriction configuration
You can restrict the domain name of a route by configuring the parameter admin.route.domain
, opening the configuration file config/admin.php
'route' => [
'domain' => env('ADMIN_ROUTE_DOMAIN'),
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
'namespace' => 'App\\Admin\\Controllers',
'middleware' => ['web', 'admin'],
],
9. Add enable or disable configuration for admin.session middleware
After 2.0
version admin.session
middleware is no longer enabled by default, if your application has both frontend and backend, you need to enable admin.session
middleware, otherwise it will cause front and backend session
conflict problem.
Set the value of the configuration parameter admin.route.enable_session_middleware
to true
to enable it
'route' => [
'domain' => env('ADMIN_ROUTE_DOMAIN'),
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
'namespace' => 'App\Admin\\Controllers',
'middleware' => ['web', 'admin'],
// enable admin.session middleware
'enable_session_middleware' => true,
],
BUG FIXES
- fix the problem that
Model
is converted toarray
format in the first parameter ofGrid::header
andGrid::footer
callback of data table - repair the problem that the color of file upload button cannot be changed when switching themes #938
- repair the invalid setting of the third parameter of
Widgets\Table
construction method - fix the problem of using
config(['admin.layout.color' => '...']) in
app/Admin/bootstrap.php` ‘ Override theme color may be invalid - fix the problem of invalid data table filter reset association form fields #949
- repair the problem of abnormal display of
group
function of table filter #929 - fix the problem that only the first set
title
is displayed in all popups when there are multipleselectTable
forms on the page #926
v2.0.15-beta
Release date 2021/1/3
To upgrade method, step by step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.15-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Feature improvements
1. Upgrade select2 to v4.1.x-beta version
Upgrade select
component to v4.1.x-beta
, make tags
form experience better, and support multi-language translation.
Widgets/Modal added vertical centering and scrollable popups.
Use as follows #901
$modal = Modal::make()
->xl()
->centered() // Set the pop-up window to be vertically centered
->scrollable() // Set the content of the pop-up window to be scrollable
->title(...)
->body(...);
3. Admin::requiredAssets
supports passing dynamic parameters
use Dcat\Admin\Admin;
// Register front-end component aliases
// {lang} is a dynamic parameter
Admin::asset()->alias('@test', [
'js' => ['/vendor/test/js/{lang}.min.js'],
]);
// {lang} will be replaced with zh_CN
Admin::requireAssets('@test', ['lang' => 'zh_CN']);
// It can also be used like this
Admin::requireAssets('@test?lang=zh_CN');
Bug修复
- Fix the problem that the form
block
layout cannot save data #883 - Fix
currency
failure underhasMany
form #886 - Repair the problem of automatically jumping to the detail page after saving the data form #893
- Fix the problem that
editor
form can not clear the data #895 - Fix the
required
validation exception oftags
underhasMany
form #905 - Repair the problem of all files being emptied when deleting a single file in multi-file upload form #914
- fix the problem that form fields cannot use model accessor
v2.0.14-beta
Release Date 2020/12/24
To upgrade the method, step by step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.14-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Function improvement
1. Optimize the error message prompt for file upload failure
In the old version, the error message for file upload failure was not very clear, which made it difficult to define the reason for the error, so in this version, the error message is optimized, and the specific reason will be displayed once the file upload fails.
Bug fixes
- fix the problem that the form field conflicts with the model
casts
attribute and the abnormal display problem using string splicing in thedisplay
closure #876 - fix the problem that the dynamic display function of the form cannot be used #879
- fix the problem of not being able to display editing data when using
Block
layout #877
v2.0.13-beta
Release Date 2020/12/23
To upgrade the method, step by step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.13-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Bug fixes
- fix the problem that the table may report an error when displaying related fields when the related data does not exist #867
- fix the problem that
display
method is invalid when the table uses data repository to return arrays or non-modelcollection
#869
v2.0.12-beta
Release Date 2020/12/22
To upgrade the method, step by step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.12-beta"
php artisan admin:publish --assets --migrations --force
php artisan migrate
Disruptive changes
1. image/file upload form removeable
renamed to removable
$form->file('...')->removable();
Feature improvement
1.Support PHP8.0
2. Image/file upload form supports listening to WebUploader events
The on
method can listen to WebUploader file upload related events
$form->file('...')
->on('startUpload', <<<JS
function () {
console.log('File upload started...', this);
// Attach custom parameters to the file upload interface before uploading files
this.uploader.options.formData['custom_field'] = '...';
}
JS
)
->on('uploadFinished', <<<JS
function () {
console.log('File upload is complete');
}
JS
);
//
3. Listen for changes when a file is successfully uploaded or deleted
You can listen for changes when a file is uploaded successfully or when a file is deleted by the following methods
$file = $form->file('...');
Admin::script(
<<<JS
$('{$file->getElementClassSelector()} .file-input').on('change', function () {
console.log('Document changed', this.value);
});
JS
);
4. Allow intercepting and responding to error messages in the uploading event
Starting from this version, we support intercepting file uploads in the uploading
event of the form and responding to error messages on the front-end.
$form->uploading(function (Form $form) {
return $form->response()->error('File upload failed, please try again!');
});
5. Listen to selectTable selected value change
$selectTable = $form->selectTable('...')->from(...);
Admin::script(
<<<JS
$('{$selectTable->getElementClassSelector()} input[type="hidden"]').on('change', function () {
console.log('Change of selected values', this.value);
});
JS
);
6. adjust the tree form no data return, cancel the return of 404 status code
7. Adjust the value type of row attribute of table displayer class to model
8. Dark mode details optimization
$grid->column(...)->modal(function () {
// $this points to the model object
dd($this);
});
$grid->actions(function () {
// $this points to the model object
dd($this);
});
9. Optimize the problem of overflowing chart display in cards
10.widget component add when method
$modal = Dcat\Admin\Widgets\Modal::make()
->when($condition, function ($modal) {
// When the value of $condition is true, the logic inside the closure will be executed
$modal->xl();
})
->body(...)
->render();
Bug fixes
- fix
Grid\Filter::group
can’t keep selected state #739 - fix
Form::hasMany
problem of validatingrequired
even after form entry is deleted #795 - fix the problem that map form cannot be used
- fix the problem that
guessClassFileName
will report error whencomposer
class mapping file is generated and the class file is deleted - fix the problem of error when using
Fetched
event for data export #815 - fix the problem that
filter
cannot be reset after settingGrid name
. - fix the problem that
select2
can’t use Chinese language pack automatically #839 - fix the problem that
continue to create
andcontinue to edit
jump route error #814 - fix
range
form settingrules
invalid when one-to-one association is enabled - fix the problem that time filtering dropdown will be blocked when
fixColumns
is enabled #833 - fix the problem that menu
fa
icon can’t be aligned automatically #758 - fix the problem of submitting errors with
hasMany
inrow
layout #801 - fix form
hasMany
can’t useselect
linkage #769
v2.0.11-beta
Release date 2020/12/06
To upgrade, step-by-step execute the following command
composer remove dcat/laravel-admin
composer require dcat/laravel-admin: "2.0.11-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # table structure changes
php artisan migrate
Bug fixes
- fix
Dcat.init
listener failure due to repeated page refreshes usingpjax
- fix
admin:export-seed --users
which generates redundant code - repair the problem of abnormal jumping after saving the form editing page
- repair the problem that
hasMany
will add data repeatedly if you choose to continue editing on the form page - fix the problem that the original
select2 config
is lost after linkingselect
forms #779 - fix
map
form loading exception problem #764 - fix the problem that the page cannot be refreshed automatically after the data is deleted by the batch delete function
- fix the problem that
hasMany
form editing page cannot displayrow
andcolumn
layouts properly - fix the problem that
Dcat.init
listener will be unbound by asynchronous pop-up window - fix a bug that the table toolbar dropdown menu is blocked by the fixed list pane #728
- fix a problem where cached content is still read when
showColumnSelector
is disabled
Functional improvements
1. Add title parameter to Form::divider.
Add title
parameter to display the title in the middle of the divider, usage
$form->divider('title');
2. Grid::footer and Grid::header adjusted to support multiple callbacks
$grid->header(...) ;
$grid->header(...) ;
$grid->header(...) ;
3. Optimize form specification filters and select form styles
v2.0.10-beta
Posted on 2020/11/29
To upgrade the method, execute the following step-by-step commands
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.10-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # Table structure changed.
php artisan migrate
Functional improvements
1. Add a prompt window in the upper right corner of the form to display field validation error messages.
This feature is enabled by default and can be disabled by the validationErrorToastr
method.
$form->validationErrorToastr(false);
2.Add Tree::maxDepth method to limit the maximum level of the model tree .
$tree->maxDepth(5);
3. Optimize the export function, support title settings associated with the relational fields and automatically read the title of the grid column .
In the current version, exported columns are the same as column
columns by default, so you no longer need to set the exported column name and translation manually, and the associated relational fields are supported.
$grid->column('id');
$grid->column('name');
...
// Default is the same as the column above
$grid->export();
4. Add a resetButton and submitButton method to the tool form.
// Disable the Reset and Submit buttons
$form->resetButton(false);
$form->submitButton(false);
5. Add parameters to the disable
and readOnly
methods of the form fields to control whether they are enabled or not.
// pass false to disable
$form->text(...)->disable(false);
6. Adding withDeleteData
to file uploads allows users to set request parameters and add primary key fields to the upload and delete interfaces.
The withDeleteData
method allows you to pass custom parameters to the file delete interface.
$form->file(...)->withDeleteData(['key' => 'value]);
7. Add embeds
form to disable display of titles.
The second parameter, passed as false
, does not display the title.
$form->embeds('field', false, function ($form) {
...
});
8. Rewrite some of the unit test cases to support 2.x usage.
Bug fixes
- fix the problem that existing permissions cannot be selected on admin detail page.
- fix the problem of
admin:export-seed
command exportingseeder
class name exception. - fix the form deletion jump exception
- fix the problem of form jumping exception when continuing to edit.
- fix the problem that parent table fields cannot be saved when parent table and
hasMany
have the same field name. - fix the problem that the style of selected submenu is abnormal in dark mode #712
- fix the problem that form dynamic display function is invalid under form
block
layout #723 - optimize the display of
selectOptions
hierarchy and solve the problem of prefix rendering increasing with the hierarchy depth index #618 - fix the problem that
admin_view
does not return data. - fix the problem that links set by
select
form,ajax
andload
cannot take parameters #745 - fix the problem that the
handle
method of the table row operationaction
can only getid
of the last row of data. - fix the problem that
list
form edit page cannot delete existing data #759 - Fix the error in the
embeds
scope form’sname
attribute.
v2.0.9-beta
Posted on 2020/11/18
To upgrade the method, execute the following step-by-step commands
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.9-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # 表结构有变动
php artisan migrate
Bug Fix.
- fix the function failure of form
filter::select
form remote load/load/ajax
etc. - fix the front-end
moment-timezone
component path loading error #701 - fix the problem of not being able to set permissions due to
Form::tree
not being able to save data. - fix the problem of filling default value exception when the
hasMany
form has the same field name as the parent table. - repair the problem of adding new page report when form
tab
layout is nested withrow
layout #648 - fix the problem of not being able to get all the values under
range
after submission when the form hasrange
type field. - fix the problem that select2 component is invalid when
Form::select
uses form linkage.
v2.0.8-beta
Posted on 2020/11/16
To upgrade the method, execute the following command step by step
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.8-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # Table structure changed
php artisan migrate
As a supplement to 2.0.7-beta
, the following issues are fixed in this release
- fix the problem of not being able to view permissions on the admin page
- fix the problem of form block layout failure
- fix the problem of abnormal initialization of file upload form.
- fix the problem that some form fields don’t support rendering multiple fields on a single page at the same time.
v2.0.7-beta
Posted on 2020/11/15
To upgrade the method, execute the following command step by step
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.7-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # Changes in table structure
php artisan migrate
Functional improvements
- Introduce the jquery.initialize component to listen to dynamically generated page elements and set a callback, the following is a simple example to demonstrate usage.
In older versions, if an element is dynamically generated by JS
, and we need to bind a click event to that element, then we usually do this
<div class="selector">test</div>
<script>
Dcat.ready(function () {
// You need to be off first and then on, otherwise page refresh will cause double bind problem.
$(document).off('click', '.selector').on('click', '.selector', function () {
...
})
});
</script>
The above approach is troublesome, you need to off
and then on
; secondly, you can not do some special treatment for dynamically generated elements, for example, if you want to change the background color after .selector
is generated, there is no way to do this.
In this version we can use the Dcat.init
method to listen to the dynamically generated elements.
<div class="selector">test</div>
<script>
Dcat.ready(function () {
// $this is the jquery dom object of the current element.
// id is the id attribute of the current element, if the current element has no id, a random id will be generated automatically.
Dcat.init('.selector', function ($this, id) {
// Change the background color of the element.
$this.css({background: "#fff"});
// There's no need for off and then on again, because the anonymous function will only be executed once!
$this.on('click', function () {
...
});
});
});
</script>
Thanks to the introduction of the jquery.initialize component, in the current version we have optimized the front-end code of the form component to support the dynamically generated form type HasMany
more easily. Significantly reduces the complexity of the code.
2.Form::hasMany and Form::array forms support column and row layout
If there are more fields, you can use column
and row
layout to save space.
$form->array('field', function (NestedForm $form) {
$form->column(6, function (NestedForm $form) {
$form->text('...');
...
});
$form->column(6, function (NestedForm $form) {
...
});
});
3.Routes configured with the admin.auth.except parameter do not require authentication privileges #673
- Add when method to Form, Grid and Show field classes
Usage examples, similar to Laravel QueryBuilder
s when
method
in the table
// Closing code will be executed when the first parameter is true.
$grid->column('title')->when(true, function (Grid\Column $column, $value) {
$column->label();
});
form (document)
// Closing code will be executed when the first parameter is true.
$form->text('email')->when(true, function (Form\Field\Text $text, $value) {
$text->type('email');
});
- Administrator model add canSeeMenu method to control whether the menu is visible or not.
<?php
namespace App\Models;
use Dcat\Admin\Models\Administrator as Model;
class Administrator extends Model
{
/**
* :: Control whether the menu is visible or not, return true by default
*
* @param array|\Illuminate\Database\Eloquent\Model $menu menu node
* @return bool
*/
public function canSeeMenu($menu)
{
return true;
}
}
6.Add admin_script、admin_style、admin_js、admin_css and admin_require_assets functions
// Equivalent to Admin::script
admin_script('console.log(xxx)');
// Equivalent to Admin::style
admin_style('.my-class {color: red}');
// Equivalent to Admin::js()
admin_js(['@admin/xxx.js']);
// Equivalent to Admin::css()
admin_css(['@admin/xxx.css']);
// Equivalent to Admin::requireAssets()
admin_require_assets(['@select2']);
- simplify the action (Action) of the
JS
code logic, to remove the memory of theselector
function
BUG FIX
- Fix anomaly in the orderable form #674
- fix the JsonResponse methodIf error.
- fix table, form, and data detail specifying
label
#684 - fix the problem that the table
Grid::rows
callback doesn’t work properly. - fix the problem of some types of statistical cards failing to load asynchronously due to exceptions in adding
JS
code to widgets. - fix the getKey method exception for table row operations #691
- fix the problem of not being able to use the linkage function when there are multiple select forms in the page.
- Fix the problem of the table not being able to refresh automatically after deleting data.
v2.0.6-beta
Posted on 2020/11/7
To upgrade the method, execute the following command step by step
composer remove dcat/laravel-admin
composer require dcat/laravel-admin:"2.0.6-beta"
php artisan admin:publish --assets --force
php artisan admin:publish --migrations --force # 表结构有变动
php artisan migrate
Breaking Changes
1.Form::tags
form is saved as array
type by default
// You need to convert the format you save to the database yourself
$form->tags('tag')->saveAsJson();
2.The session middleware is disabled by default
3.Form\Tree::disableFilterParents
renamed to Form\Tree::exceptParentNode
$form->tree('cate')->exceptParentNode(false);
- Adjust the method name of the file upload form part ```php // Enable chunked uploads, disableChunked changed to chunked $form->image(‘avatar’)->chunked(true);
// Enable auto-save field values, disableAutoSave changed to autoSave $form->image(‘avatar’)->autoSave(false);
// Enable the file deletion function, disableRemove changed to removable $form->image(‘avatar’)->removable(false);
**Functional improvements**
1.Code generator add field dragging sorting function, this method is contributed by partner [@codingyu](https://github.com/codingyu).
2. menu table to add `show` and `extension` field, `show` field is used to control whether to display the menu; `extension` field is used to mark whether to expand the menu
3.`Form::table`、`Form::array`、`Form::embeds` supports relational fields
```php
$form->table('profile.options', function ($form) {
...
});
Add vertical display of
Form::checkbox
andForm::radio
form options.$form->checkbox('xxx')->inline(false)->options([...]);
Configuration file skip login and permission authentication allows configuration of routing aliases.
'auth' => [
'except' => [
...
'user.login',
],
],
6.Form\Row
adds getKey
and model
methods
Optimize the form filter select form selection effect, the default is not selected
Form tab layout optimization
BUG FIX
- fix
Form::checkbox
problem when check/uncheck all options. - fix the problem that the default menu TITLE can not be translated in Taiwan Traditional Chinese.
- fix the problem that the
number
field inNestedForm
is filtered when the input value is 0 #634 - fix the problem of getting primary key error when the model tree
RowAction
asynchronously processes the interface. - Fix the problem of table filters failing to reset the search value of the associated table fields [#650] (https://github.com/jqhph/dcat-admin/issues/650)
- fix form filter multipleSelect form exception problem
v2.0.5-beta
Posted on 2020/10/29
BUG FIXES
- fix the problem of table search multiple related table fields sql error I232T7
- fix the problem of
Form::datetimeRange
form not being able to select logs. - Fix the problem of not being able to add multiple
Form::table
form fields #627 - fix the error in the form filter MultipleSelectTable.
- Fix the problem of abnormal style of table specification filter.
v2.0.4-beta
Posted on 2020/10/27
BUG FIXES
- fix the problem that the admin_javascript_json function will automatically empty-filter an array of null values.
- fix the error of using tab layout for data form #620
- fix the problem of abnormal permissions for temporary directories generated by extended local installation #625
- fix the error when using html method to set view with script tag #624.
- Fix the error of displaying data details using correlations (one-to-many) #623
- fix the dropdown menu calculation display position exception #I22S2N
v2.0.3-beta
Posted on 2020/10/27
BUG FIXES
- fix the problem of abnormal display of return information in form row editing
- Fix invalid setting of
admin.auth.member
#613 - fix the abnormal Chinese translation problem of
editor
form #611 - fix the problem that
Filter::scope
can’t filter pagination parameters when selecting filter item. - fix issues related to form event interception
- Fix the problem of abnormal use of tree form #619
Functional improvements
- add the configuration of skip privileges and login authentication
- Extending the service provider to include middleware and route-checking registrations
- batch operation change event monitoring optimization
- Increase
RowSelector
robustness to avoid errors due to unprocessedjson
array type fields #609
v2.0.2-beta
Posted on 2020/10/21
BUG FIXES
- Fix naming space exception in controller file generated by code generator #600
- fix the problem of configuration file logo path error
- Fix the problem of invalid search for associated fields in tables
- fix the problem of duplicate selectors generated by model tree operation
- fix the problem of accessing permissionless page report
- Fix the problem that table filter multipleSelect cannot select the value of the associated table field #603
- Fix invalid form tab layout #605
Functional improvements
- Auth\Permission to move to Http directory
- Replace the json field in the data table with text
- add login password error translation
- add admin_javascript_json function, make most of the component configuration support passing JS code
- Admin::color Add dark mode color.
v2.0.1-beta
Posted on 2020/10/20
BUG FIXES
- Fix data table filter search bug #599
- Fix code generator error in generating controller base class namespace #600
Functional improvements
- Code Generator adds page TITLE and breadcrumb translation functionality.
- Exception handling optimization
- Add admin_setting_array function.