Skip to content

Commit

Permalink
Fix Deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: Lloric Mayuga Garcia <lloricode@gmail.com>
  • Loading branch information
lloricode committed Sep 3, 2019
1 parent 7ae86cf commit eb7a007
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/CollectionDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ protected function defaultOrdering()

$this->collection = $this->collection
->map(function ($data) {
return array_dot($data);
return Arr::dot($data);
})
->sort($sorter)
->map(function ($data) {
foreach ($data as $key => $value) {
unset($data[$key]);
array_set($data, $key, $value);
Arr::set($data, $key, $value);
}

return $data;
Expand Down
5 changes: 3 additions & 2 deletions src/DataTableAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Yajra\DataTables;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Psr\Log\LoggerInterface;
use Illuminate\Http\JsonResponse;
Expand Down Expand Up @@ -255,7 +256,7 @@ public function escapeColumns($columns = '*')
*/
public function makeHidden(array $attributes = [])
{
$this->columnDef['hidden'] = array_merge_recursive(array_get($this->columnDef, 'hidden', []), $attributes);
$this->columnDef['hidden'] = array_merge_recursive(Arr::get($this->columnDef, 'hidden', []), $attributes);

return $this;
}
Expand Down Expand Up @@ -547,7 +548,7 @@ protected function getColumnsDefinition()
$config = $this->config->get('datatables.columns');
$allowed = ['excess', 'escape', 'raw', 'blacklist', 'whitelist'];

return array_replace_recursive(array_only($config, $allowed), $this->columnDef);
return array_replace_recursive(Arr::only($config, $allowed), $this->columnDef);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/DataTablesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Yajra\DataTables;

use Illuminate\Support\Str;
use Yajra\DataTables\Utilities\Config;
use Illuminate\Support\ServiceProvider;
use Yajra\DataTables\Utilities\Request;
Expand Down Expand Up @@ -42,7 +43,7 @@ public function boot()
{
$engines = config('datatables.engines');
foreach ($engines as $engine => $class) {
$engine = camel_case($engine);
$engine = Str::camel($engine);

if (! method_exists(DataTables::class, $engine) && ! DataTables::hasMacro($engine)) {
DataTables::macro($engine, function () use ($class) {
Expand Down Expand Up @@ -77,6 +78,6 @@ protected function setupAssets()
*/
protected function isLumen()
{
return str_contains($this->app->version(), 'Lumen');
return Str::contains($this->app->version(), 'Lumen');
}
}
6 changes: 3 additions & 3 deletions src/Processors/DataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected function escapeColumns(array $output)
} elseif (is_array($this->escapeColumns)) {
$columns = array_diff($this->escapeColumns, $this->rawColumns);
foreach ($columns as $key) {
array_set($row, $key, e(array_get($row, $key)));
Arr::set($row, $key, e(Arr::get($row, $key)));
}
}

Expand All @@ -259,15 +259,15 @@ protected function escapeColumns(array $output)
*/
protected function escapeRow(array $row)
{
$arrayDot = array_filter(array_dot($row));
$arrayDot = array_filter(Arr::dot($row));
foreach ($arrayDot as $key => $value) {
if (! in_array($key, $this->rawColumns)) {
$arrayDot[$key] = e($value);
}
}

foreach ($arrayDot as $key => $value) {
array_set($row, $key, $value);
Arr::set($row, $key, $value);
}

return $row;
Expand Down
3 changes: 2 additions & 1 deletion src/Utilities/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Yajra\DataTables\Utilities;

use DateTime;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Contracts\Support\Arrayable;

Expand Down Expand Up @@ -156,7 +157,7 @@ public static function getOrMethod($method)
*/
public static function convertToArray($row, $filters = [])
{
$row = method_exists($row, 'makeHidden') ? $row->makeHidden(array_get($filters, 'hidden', [])) : $row;
$row = method_exists($row, 'makeHidden') ? $row->makeHidden(Arr::get($filters, 'hidden', [])) : $row;
$data = $row instanceof Arrayable ? $row->toArray() : (array) $row;

foreach ($data as &$value) {
Expand Down

0 comments on commit eb7a007

Please sign in to comment.