Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ready] Release 3.5 - this is HUUUUGE #1647

Merged
merged 183 commits into from
Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
dd83f27
Update AutoSet.php
jeanbernard69 May 1, 2017
a4b7f62
Allow custom sorting for crud columns
Jan 9, 2018
23acdd3
Fix comments.
Jan 17, 2018
e3d5e33
Replace ucfirst with mb_convert_case
justnero May 1, 2018
3afbbbd
Merge branch 'fix-1370' of git://github.com/justnero-ru/CRUD into jus…
tabacitu May 10, 2018
b7596e9
fixes #1370 - multibyte ucfirst
tabacitu May 10, 2018
dfe85df
leftover mb_convert_case
tabacitu May 10, 2018
62e4e5f
Added Google address field
alanbrande May 25, 2018
8bb6f3a
pass all form inputs to select2_from_array and select2_from_array_mul…
tabacitu Jun 29, 2018
7147634
Added setters and getters for the current CRUD operation
tabacitu Jul 8, 2018
0d9518d
Apply fixes from StyleCI (#1515)
tabacitu Jul 8, 2018
038fc17
made CrudPanel class macroable
tabacitu Jul 8, 2018
79a0589
Apply fixes from StyleCI (#1517)
tabacitu Jul 8, 2018
eae5c89
treats #1347 - custom headings and title
tabacitu Jul 10, 2018
432f562
Apply fixes from StyleCI (#1526)
tabacitu Jul 10, 2018
189c970
removed fallback from getTitle getHeading and getSubheading
tabacitu Jul 10, 2018
5a2d6e4
fixed merge conflicts
tabacitu Jul 10, 2018
4e27b27
Apply fixes from StyleCI (#1528)
tabacitu Jul 10, 2018
8f5ca73
fixes #1416
tabacitu Jul 11, 2018
e9d155b
Apply fixes from StyleCI (#1534)
tabacitu Jul 11, 2018
f4151e8
Changed Google address field to read API key from crud config file
alanbrande Jul 12, 2018
fca7cfe
Merge branch 'master' into feature-pass-form-to-select2-from-array
tabacitu Aug 10, 2018
aa4d6bb
bumped version
tabacitu Aug 10, 2018
adf9637
Added a field that enables the selection and ordering of an array.
joaojoyce Sep 3, 2018
68d5abb
Merge branch 'master' into fix-order-by-with-column-heading-click
tabacitu Sep 24, 2018
6db0ebd
fixes #1602
tabacitu Sep 24, 2018
70a09e2
fixed merge conflicts
tabacitu Sep 24, 2018
e580989
use dot notation when getting old value (example on only text field)
pestopancake Oct 4, 2018
21652b0
Fix access to $crud in button from model function
aand18 Oct 15, 2018
15e65c4
add option to override the content class of list/create/edit
tswonke Oct 16, 2018
b905f5c
Pass parameters to column function
bl8m Oct 31, 2018
819f236
polished list view so information takes center-stage
tabacitu Oct 31, 2018
d5150c5
pagination links are no longer rounded in list view
tabacitu Nov 1, 2018
085912f
added filter icon to list view
tabacitu Nov 1, 2018
fb3600f
list view header better on mobile
tabacitu Nov 1, 2018
777dd10
list view moved the bottom buttons before the list view and made them…
tabacitu Nov 1, 2018
a178b16
consistently good list view style with all features or without
tabacitu Nov 2, 2018
fbec95e
added datatables fixed header on responsive table for better UX on ta…
tabacitu Nov 2, 2018
176eb45
datatables loading screen improvements
tabacitu Nov 2, 2018
11ad66c
check that model has crudtrait
tabacitu Nov 8, 2018
dfbd4ff
Apply fixes from StyleCI (#1679)
tabacitu Nov 8, 2018
7cbc57f
fixed merge conflicts
tabacitu Nov 8, 2018
9252a0a
merged
tabacitu Nov 8, 2018
acfde52
changelog; bumped version
tabacitu Nov 8, 2018
4584e07
breadcrumbs are back
tabacitu Nov 8, 2018
1421670
Merge branch 'list-view-facelift' into release-3-5
tabacitu Nov 8, 2018
69b0a46
changelog
tabacitu Nov 8, 2018
b8b17a9
Merge branch 'master' into setters-and-getters-for-operations
tabacitu Nov 8, 2018
6133a64
Merge branch 'release-3-5' into setters-and-getters-for-operations
tabacitu Nov 8, 2018
8e89e4d
operation name is now the trait name - upper camel case
tabacitu Nov 8, 2018
afb3f26
changelog
tabacitu Nov 8, 2018
382a632
fixed merge conflicts
tabacitu Nov 8, 2018
20becfe
changelog
tabacitu Nov 8, 2018
fcc27d9
fixed unit tests
tabacitu Nov 8, 2018
033e643
Apply fixes from StyleCI (#1681)
tabacitu Nov 8, 2018
0c03e80
Merge branch 'master' into macroable-crud-panel
tabacitu Nov 8, 2018
70d2d5b
fixed merge conflicts
tabacitu Nov 8, 2018
9653c02
Apply fixes from StyleCI (#1682)
tabacitu Nov 8, 2018
bafb5ec
merge conflicts
tabacitu Nov 8, 2018
489e759
fixed merge conflicts
tabacitu Nov 8, 2018
460c0e1
fixed merge conflicts
tabacitu Nov 8, 2018
dbe2270
Merge branch 'macroable-crud-panel' of https://github.com/Laravel-Bac…
tabacitu Nov 8, 2018
b278cb0
crud panel macroable - throw error if method already exists
tabacitu Nov 8, 2018
c616009
Apply fixes from StyleCI (#1683)
tabacitu Nov 8, 2018
1d00bba
Apply fixes from StyleCI (#1684)
tabacitu Nov 8, 2018
db4012f
Merge pull request #1518 from Laravel-Backpack/macroable-crud-panel
tabacitu Nov 8, 2018
e23c46e
Merge pull request #1658 from aand18/patch-1
tabacitu Nov 8, 2018
e756661
changelog
tabacitu Nov 8, 2018
d5ea099
Update CHANGELOG.md
tabacitu Nov 9, 2018
5f9e86f
Merge branch 'master' into feature-override-content-class
tabacitu Nov 9, 2018
b95549a
merged release-3-5 into feature-override-content-class
tabacitu Nov 9, 2018
740fd4c
merged
tabacitu Nov 9, 2018
1fc0f50
changelog
tabacitu Nov 9, 2018
a4b2d37
Merge branch 'release-3-5' into feature-override-content-class
tabacitu Nov 9, 2018
d14ff07
added select2_nested field type
tabacitu Nov 9, 2018
6ee66ec
prettier select2_nested field
tabacitu Nov 9, 2018
c11e2c9
changelog
tabacitu Nov 9, 2018
850fa43
fixes #502
tabacitu Nov 9, 2018
2fb64b5
added select2_grouped which does the same
tabacitu Nov 9, 2018
05025d6
fixed merge conflicts
tabacitu Nov 9, 2018
d1b72bc
added str_brackets_to_dots helper
tabacitu Nov 10, 2018
7e21af2
Apply fixes from StyleCI (#1691)
tabacitu Nov 10, 2018
099439b
added str_brackets_to_dots to all fields
tabacitu Nov 10, 2018
96e1528
Merge branch 'pestopancake-pestopancake-patch-1' of https://github.co…
tabacitu Nov 10, 2018
570d73c
renamed str_brackets_to_dots to square_brackets_to_dots
tabacitu Nov 10, 2018
85709d7
merged mb_ucfirst
tabacitu Nov 11, 2018
2660562
Merge branch 'justnero-ru-fix-1370' into release-3-5
tabacitu Nov 11, 2018
e2c8928
changelog
tabacitu Nov 11, 2018
2ec784e
Added callback options for select field type
tabacitu Nov 11, 2018
58dd793
autoload the base helpers
tabacitu Nov 11, 2018
d84930c
Merge branch 'release-3-5' into relationship-fields-with-callback
tabacitu Nov 11, 2018
9783135
added options option for select2, select2_multiple and select_multipl…
tabacitu Nov 11, 2018
924f94b
cleaned up select2_multiple and select_multiple
tabacitu Nov 11, 2018
137a793
Merge branch 'select_and_order' of git://github.com/joaojoyce/CRUD in…
tabacitu Nov 11, 2018
6ef6a1e
polished select_and_order field type
tabacitu Nov 11, 2018
4db02f7
polished select_and_order field type design
tabacitu Nov 11, 2018
11491cb
polished select_and_order field type design
tabacitu Nov 11, 2018
de8ad7b
better select_and_order design
tabacitu Nov 12, 2018
6e11002
polished Show design so it matches the new ListEntries design; added …
tabacitu Nov 12, 2018
827dcbf
used panels padding and made all other operations look similar to new…
tabacitu Nov 12, 2018
ae78bc7
small design fix
tabacitu Nov 12, 2018
82e9d2c
revisions back button is outside resizable container
tabacitu Nov 12, 2018
d058642
Apply fixes from StyleCI (#1699)
tabacitu Nov 12, 2018
e909b63
fixed merge conflicts
tabacitu Nov 12, 2018
097d097
Merge branch 'release-3-5' of https://github.com/Laravel-Backpack/CRU…
tabacitu Nov 12, 2018
065e44e
remove underscores from label names if the label has not been set - f…
tabacitu Nov 12, 2018
41f0c2c
better edit and show for translatable entities
tabacitu Nov 13, 2018
1ca7b81
returned from panels to boxes, for backwards-compatibility; we can al…
tabacitu Nov 13, 2018
6300893
update URL when filtering; save datatable state
tabacitu Nov 13, 2018
105369b
when creating and updating ignore http_referrer attribute
tabacitu Nov 13, 2018
a264ffe
show reorder revisions back buttons take you to filtered list view
tabacitu Nov 13, 2018
a77c811
cleaned up filters remember url logic
tabacitu Nov 13, 2018
8fc513b
separated persistent table into its own feature, which can be toggled
tabacitu Nov 13, 2018
17a6729
persistent table feature
tabacitu Nov 13, 2018
7402a91
when using tabs, fields that do not belong in tabs also look good
tabacitu Nov 14, 2018
bc26132
unit tests for CrudPanel Views trait
tabacitu Nov 14, 2018
42a52c9
added exportable option to columns
tabacitu Nov 15, 2018
1cb109a
added hidden option to columns
tabacitu Nov 15, 2018
e4d3144
rename hidden columns option to visibleInTable
tabacitu Nov 15, 2018
e84c1da
renamed exportable to visibleInExport
tabacitu Nov 15, 2018
8c5fe17
fixed tabbed forms not working on edit
tabacitu Nov 15, 2018
5a7551d
Merge branch 'export-improvements' into release-3-5
tabacitu Nov 15, 2018
89e38e1
changelog
tabacitu Nov 15, 2018
0a34812
Merge pull request #1694 from Laravel-Backpack/relationship-fields-wi…
tabacitu Nov 15, 2018
f8647f7
changelog
tabacitu Nov 15, 2018
46e84ae
Merge pull request #1695 from Laravel-Backpack/joaojoyce-select_and_o…
tabacitu Nov 15, 2018
a3ab2b5
changelog
tabacitu Nov 15, 2018
e7cc807
fixed merge conflicts
tabacitu Nov 15, 2018
a340015
merged 3.5 into this pr
tabacitu Nov 15, 2018
ca7a098
better docblock for orderLogic method
tabacitu Nov 15, 2018
bbca79f
Merge pull request #1704 from Laravel-Backpack/ran81-custom-orderby
tabacitu Nov 15, 2018
c370a69
changelog
tabacitu Nov 15, 2018
639dd9d
Update model_function_attribute.blade.php
bl8m Nov 15, 2018
c7efd15
Merge branch 'master' into release-3-5
tabacitu Nov 16, 2018
cc915cb
fixes #791
tabacitu Nov 16, 2018
cad7f39
changelog
tabacitu Nov 16, 2018
d223ac2
fixes #1641 - added visibleInShow attribute to columns
tabacitu Nov 16, 2018
68d17f3
Merge pull request #1706 from Laravel-Backpack/visibleInShow
tabacitu Nov 16, 2018
194419d
changelog
tabacitu Nov 16, 2018
890aa5e
added clone operation - fixes #28
tabacitu Nov 16, 2018
c1bbeac
Apply fixes from StyleCI (#1707)
tabacitu Nov 16, 2018
66126c2
added clone access and button as default
tabacitu Nov 16, 2018
22ee161
Merge branch 'added-clone-operation' of https://github.com/Laravel-Ba…
tabacitu Nov 16, 2018
735f967
changelog
tabacitu Nov 16, 2018
a08600c
fixes #1560 - assuming ConvertEmptyStringsToNull when using mysql str…
tabacitu Nov 16, 2018
7ef1188
fixed buttons unit tests - broken by adding the clone button
tabacitu Nov 16, 2018
4816c6c
merged
tabacitu Nov 16, 2018
58c950c
Merge pull request #1709 from Laravel-Backpack/ConvertEmptyStringsToNull
tabacitu Nov 16, 2018
0e18e1c
Merge branch 'master' of git://github.com/Light-it-labs/CRUD into Lig…
tabacitu Nov 20, 2018
1ffffe9
changed google places api key config location
tabacitu Nov 20, 2018
90a1b7c
renamed address field to address_algolia with backwards-compatible alias
tabacitu Nov 20, 2018
fce44c0
removed conflict with algolia input
tabacitu Nov 20, 2018
16c3be5
removed google places api key from config file
tabacitu Nov 20, 2018
277a1bb
Merge branch 'Light-it-labs-master' into release-3-5
tabacitu Nov 20, 2018
903712b
changelog
tabacitu Nov 20, 2018
0a9d097
autoset table columns get pulled once
tabacitu Nov 20, 2018
ca4f618
Apply fixes from StyleCI (#1713)
tabacitu Nov 20, 2018
666b18e
changelog
tabacitu Nov 20, 2018
3e0cd36
Apply fixes from StyleCI (#1715)
tabacitu Nov 20, 2018
bc0d8a8
Merge branch 'jeanbernard69-patch-1' into release-3-5
tabacitu Nov 20, 2018
222d9a9
Merge branch 'release-3-5' of https://github.com/Laravel-Backpack/CRU…
tabacitu Nov 20, 2018
2d094b0
merged master into release-3.5
tabacitu Nov 20, 2018
5367f42
fixed merge conflicts
tabacitu Nov 20, 2018
5f092cb
changelog
tabacitu Nov 20, 2018
f2a6de9
added ability to pass parameters to model_function column
tabacitu Nov 20, 2018
2ed0b6a
Merge branch 'patch-2' of git://github.com/bl8m/CRUD into bl8m-patch-2
tabacitu Nov 20, 2018
fde0fe7
Merge branch 'release-3-5' into bl8m-patch-2
tabacitu Nov 20, 2018
31f0e69
parameters for model function attribute column type
tabacitu Nov 20, 2018
2bc6859
changelog
tabacitu Nov 20, 2018
692fbf2
mergetool
tabacitu Nov 20, 2018
7364010
Merge branch 'release-3-5' into feature-pass-form-to-select2-from-array
tabacitu Nov 20, 2018
7143bdf
added ability to clear input when dependencies change
tabacitu Nov 20, 2018
4cea798
added method attribute to ajax selects
tabacitu Nov 20, 2018
6b2bb2d
changelog
tabacitu Nov 20, 2018
1e70f43
Merge branch 'release-3-5' into save-state-datatables
tabacitu Nov 20, 2018
62b2c8b
changelog
tabacitu Nov 20, 2018
0622f8e
renamed getTableColumns to getDbTableColumns
tabacitu Nov 20, 2018
7d8312b
fixed unit tests
tabacitu Nov 20, 2018
e373230
renamed operations
tabacitu Nov 22, 2018
8142700
Apply fixes from StyleCI (#1720)
tabacitu Nov 22, 2018
cb81b3c
added settings public property on CrudPanel object to have a place fo…
tabacitu Nov 22, 2018
e784cf1
Merge branch 'release-3-5' of https://github.com/Laravel-Backpack/CRU…
tabacitu Nov 22, 2018
82d2c54
mergetool
tabacitu Nov 22, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@ All Notable changes to `Backpack CRUD` will be documented in this file
- Nothing
-----------

## [3.5.0] - 2018-09-xx

### BREAKING
- #1535 - orderBy gets ignored when the user clicks on a column heading to reoder the datatable;
- #1658 - model function button did not pass $crud to button;
- #1680 - Backpack checks that CrudTrait is used on the Model; otherwise it throws a 500 error with a clear message;

### Added
- #1675 - design facelift for the list view - a lot cleaner;
- #1516 - setters and getters for the current operation;
- #1527 - custom titles, headings and subheadings;
- #1518 - CrudPanel class is now macroable;
- #1687 - ```select2_nested``` field type;
- #1703 - ```visibleInTable``` option to columns;
- #1703 - ```visibleInExport``` option to columns;
- #1706 - added ```visibleInShow``` option to columns;
- #1704 - added ```orderLogic``` option for columns;
- #1694 - ```options``` option to ```select```, ```select2```, ```select_multiple```, ```select2_multiple```, that allows developers to filter or order the options shown, using a scope or custom query;
- #1695 - added ```select_and_order``` field type;
- #1708 - added ```Clone``` operation;
- #1712 - added ```address_google``` field type;
- #1674 - you can now pass parameters to ```model_function``` and ```model_function_attribute``` column types;
- #1484 - added dependant select2s with ajax;
- #1484 - added ```method``` attribute to ajax select2s;
- #1484 - added ```dependencies``` attribute to ajax select2s;
- #1702 - added ```persistent_table``` functionality, and save state datatables;

### Fixed
- #1390 - using our own helper ```mb_ucfirst()``` instead of ```ucfirst()```;
- #791 - could not revert changes made in fake field holders;
- #1712 - renamed ```address``` field type to ```address_algolia```; alias keeps backwards-compatibility;
- #1714 - autoset getting tables now happens only once;
- #1692 - we can now use arrays for field names, like ```category[0][name]```, the only thing that needed to be fixed was the ```old()``` value which did not work;

----

## [3.4.43] - 2018-11-21

## Fixed
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"psr-4": {
"Backpack\\CRUD\\Tests\\": "tests"
},
"files": ["vendor/backpack/base/src/helpers.php"],
"exclude-from-classmap": [
"**/config"
]
Expand Down
24 changes: 22 additions & 2 deletions src/CrudPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@
use Backpack\CRUD\PanelTraits\Filters;
use Backpack\CRUD\PanelTraits\Reorder;
use Backpack\CRUD\PanelTraits\AutoFocus;
use Backpack\CRUD\PanelTraits\Macroable;
use Backpack\CRUD\PanelTraits\FakeFields;
use Backpack\CRUD\PanelTraits\Operations;
use Backpack\CRUD\PanelTraits\FakeColumns;
use Illuminate\Database\Eloquent\Collection;
use Backpack\CRUD\PanelTraits\RequiredFields;
use Backpack\CRUD\PanelTraits\HeadingsAndTitle;
use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions;

class CrudPanel
{
use Create, Read, Search, Update, Delete, Errors, Reorder, Access, Columns, Fields, Query, Buttons, AutoSet, FakeFields, FakeColumns, ViewsAndRestoresRevisions, AutoFocus, Filters, Tabs, Views, RequiredFields;
// load all the default CrudPanel features
use Create, Read, Search, Update, Delete, Errors, Reorder, Access, Columns, Fields, Query, Buttons, AutoSet, FakeFields, FakeColumns, ViewsAndRestoresRevisions, AutoFocus, Filters, Tabs, Views, RequiredFields, HeadingsAndTitle, Operations;
// allow developers to add their own closures to this object
use Macroable;

// --------------
// CRUD variables
Expand All @@ -43,6 +49,16 @@ class CrudPanel
public $entity_name = 'entry'; // what name will show up on the buttons, in singural (ex: Add entity)
public $entity_name_plural = 'entries'; // what name will show up on the buttons, in plural (ex: Delete 5 entities)
public $request;
public $settings = [
'create' => [],
'update' => [],
'list' => [],
'delete' => [],
'clone' => [],
'reorder' => [],
'revisions' => [],
'show' => [],
];

public $access = ['list', 'create', 'update', 'delete'/* 'revisions', reorder', 'show', 'details_row' */];

Expand Down Expand Up @@ -91,7 +107,11 @@ public function __construct()
public function setModel($model_namespace)
{
if (! class_exists($model_namespace)) {
throw new \Exception('This model does not exist.', 404);
throw new \Exception('The model does not exist.', 500);
}

if (! method_exists($model_namespace, 'hasCrudTrait')) {
throw new \Exception('Please use CrudTrait on the model.', 500);
}

$this->model = new $model_namespace();
Expand Down
10 changes: 10 additions & 0 deletions src/CrudRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ public function __construct($name, $controller, $options)
'as' => 'crud.'.$this->name.'.restoreRevision',
'uses' => $this->controller.'@restoreRevision',
]);

Route::get($this->name.'/{id}/clone', [
'as' => 'crud.'.$this->name.'.clone',
'uses' => $this->controller.'@clone',
]);

Route::post($this->name.'/bulk-clone', [
'as' => 'crud.'.$this->name.'.bulkClone',
'uses' => $this->controller.'@bulkClone',
]);
}

/**
Expand Down
13 changes: 12 additions & 1 deletion src/CrudServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CrudServiceProvider extends ServiceProvider
{
use CrudUsageStats;

const VERSION = '3.4.43';
const VERSION = '3.5.0';

protected $commands = [
\Backpack\CRUD\app\Console\Commands\Install::class,
Expand Down Expand Up @@ -92,6 +92,9 @@ public function register()
return new CRUD($app);
});

// register the helper functions
$this->loadHelpers();

// register the artisan commands
$this->commands($this->commands);

Expand All @@ -106,6 +109,14 @@ public static function resource($name, $controller, array $options = [])
return new CrudRouter($name, $controller, $options);
}

/**
* Load the Backpack helper methods, for convenience.
*/
public function loadHelpers()
{
require_once __DIR__.'/helpers.php';
}

/**
* Checks to see if we should automatically publish
* vendor files from the public tag.
Expand Down
5 changes: 5 additions & 0 deletions src/CrudTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

trait CrudTrait
{
public static function hasCrudTrait()
{
return true;
}

/*
|--------------------------------------------------------------------------
| Methods for ENUM and SELECT crud fields.
Expand Down
48 changes: 31 additions & 17 deletions src/PanelTraits/AutoSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ public function setFromDb()
*/
public function getDbColumnTypes()
{
$table = $this->model->getTable();
$conn = $this->model->getConnection();
$table_columns = $conn->getDoctrineSchemaManager()->listTableColumns($table);

foreach ($table_columns as $key => $column) {
foreach ($this->getDbTableColumns() as $key => $column) {
$column_type = $column->getType()->getName();
$this->db_column_types[$column->getName()]['type'] = trim(preg_replace('/\(\d+\)(.*)/i', '', $column_type));
$this->db_column_types[$column->getName()]['default'] = $column->getDefault();
Expand All @@ -69,6 +65,26 @@ public function getDbColumnTypes()
return $this->db_column_types;
}

/**
* Get all columns in the database table.
*
* @return array
*/
public function getDbTableColumns()
{
if (isset($this->table_columns) && $this->table_columns) {
return $this->table_columns;
}

$table = $this->model->getTable();
$conn = $this->model->getConnection();
$columns = $conn->getDoctrineSchemaManager()->listTableColumns($table);

$this->table_columns = $columns;

return $this->table_columns;
}

/**
* Intuit a field type, judging from the database column type.
*
Expand Down Expand Up @@ -97,46 +113,44 @@ public function getFieldTypeFromDbColumnType($field)
case 'mediumint':
case 'longint':
return 'number';
break;
break;

case 'string':
case 'varchar':
case 'set':
return 'text';
break;
break;

// case 'enum':
// return 'enum';
// break;

case 'tinyint':
return 'active';
break;
break;

case 'text':
return 'textarea';
break;

case 'mediumtext':
case 'longtext':
return 'textarea';
break;
break;

case 'date':
return 'date';
break;
break;

case 'datetime':
case 'timestamp':
return 'datetime';
break;
break;

case 'time':
return 'time';
break;
break;

default:
return 'text';
break;
break;
}
}

Expand Down Expand Up @@ -165,7 +179,7 @@ public function makeLabel($value)
return ($this->labeller)($value);
}

return trim(preg_replace('/(id|at|\[\])$/i', '', ucfirst(str_replace('_', ' ', $value))));
return trim(preg_replace('/(id|at|\[\])$/i', '', mb_ucfirst(str_replace('_', ' ', $value))));
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/PanelTraits/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function initButtons()
$this->addButton('line', 'show', 'view', 'crud::buttons.show', 'end');
$this->addButton('line', 'update', 'view', 'crud::buttons.update', 'end');
$this->addButton('line', 'revisions', 'view', 'crud::buttons.revisions', 'end');
$this->addButton('line', 'clone', 'view', 'crud::buttons.clone', 'end');
$this->addButton('line', 'delete', 'view', 'crud::buttons.delete', 'end');

// top stack
Expand Down
6 changes: 3 additions & 3 deletions src/PanelTraits/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function setColumns($columns)
} else {
$this->addColumn([
'name' => $column,
'label' => ucfirst($column),
'label' => mb_ucfirst($column),
'type' => 'text',
]);
}
Expand All @@ -49,7 +49,7 @@ public function setColumns($columns)
if (is_string($columns)) {
$this->addColumn([
'name' => $columns,
'label' => ucfirst($columns),
'label' => mb_ucfirst($columns),
'type' => 'text',
]);
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public function addDefaultTypeToColumn($column)
public function addDefaultLabel($array)
{
if (! array_key_exists('label', (array) $array) && array_key_exists('name', (array) $array)) {
$array = array_merge(['label' => ucfirst($this->makeLabel($array['name']))], $array);
$array = array_merge(['label' => mb_ucfirst($this->makeLabel($array['name']))], $array);

return $array;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PanelTraits/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function addField($field, $form = 'both')

// if the label is missing, we should set it
if (! isset($completeFieldsArray['label'])) {
$completeFieldsArray['label'] = ucfirst($completeFieldsArray['name']);
$completeFieldsArray['label'] = mb_ucfirst(str_replace('_', ' ', $completeFieldsArray['name']));
}

// if the field type is missing, we should set it
Expand Down
Loading