Skip to content

Commit

Permalink
supporting 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Sep 20, 2019
1 parent 78668f6 commit 1ad7750
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Frozennode/Administrator/DataTable/Columns/Column.php
Expand Up @@ -150,7 +150,7 @@ public function build()
$options['sort_field'] = $this->validator->arrayGet($options, 'sort_field', $options['column_name']);

//if the supplied item is an accessor, make this unsortable for the moment
if (method_exists($model, camel_case('get_'.$options['column_name'].'_attribute')) && $options['column_name'] === $options['sort_field']) {
if (method_exists($model, \Str::camel('get_'.$options['column_name'].'_attribute')) && $options['column_name'] === $options['sort_field']) {
$options['sortable'] = false;
}

Expand All @@ -160,7 +160,7 @@ public function build()
}

//now we do some final organization to categorize these columns (useful later in the sorting)
if (method_exists($model, camel_case('get_'.$options['column_name'].'_attribute')) || $select) {
if (method_exists($model, \Str::camel('get_'.$options['column_name'].'_attribute')) || $select) {
$options['is_computed'] = true;
} else {
$options['is_included'] = true;
Expand Down
18 changes: 11 additions & 7 deletions src/controllers/AdminController.php
Expand Up @@ -40,6 +40,7 @@ class AdminController extends Controller
*/
public function __construct(Request $request, Session $session)
{

$this->request = $request;
$this->session = $session;

Expand Down Expand Up @@ -418,11 +419,11 @@ public function updateOptions($modelName)
//iterate over the supplied constrained fields
foreach ($this->request->input('fields', array()) as $field) {
//get the constraints, the search term, and the currently-selected items
$constraints = array_get($field, 'constraints', array());
$term = array_get($field, 'term', array());
$type = array_get($field, 'type', false);
$fieldName = array_get($field, 'field', false);
$selectedItems = array_get($field, 'selectedItems', false);
$constraints = \Arr::get($field, 'constraints', array());
$term = \Arr::get($field, 'term', array());
$type = \Arr::get($field, 'type', false);
$fieldName = \Arr::get($field, 'field', false);
$selectedItems = \Arr::get($field, 'selectedItems', false);

$response[$fieldName] = $fieldFactory->updateRelationshipOptions($fieldName, $type, $constraints, $selectedItems, $term);
}
Expand Down Expand Up @@ -635,12 +636,15 @@ public function switchLocale($locale)
*/
protected function resolveDynamicFormRequestErrors(Request $request)
{

try {
$config = app('itemconfig');
$fieldFactory = app('admin_field_factory');
} catch (\ReflectionException $e) {
} catch (\Illuminate\Contracts\Container\BindingResolutionException $e) {
return;
}


if (array_key_exists('form_request', $config->getOptions())) {
try {
$model = $config->getFilledDataModel($request, $fieldFactory->getEditFields(), $request->id);
Expand All @@ -656,7 +660,7 @@ protected function resolveDynamicFormRequestErrors(Request $request)
return $errorMessages;
}
if ($errorsArray) {
return implode('.', array_dot($errorsArray));
return implode('.', \Arr::dot($errorsArray));
}
}
}
Expand Down

0 comments on commit 1ad7750

Please sign in to comment.