for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cortex\Fort\DataTables\Backend;
use Cortex\Fort\Models\Role;
use Cortex\Foundation\DataTables\AbstractDataTable;
use Cortex\Fort\Transformers\Backend\RoleTransformer;
class RolesDataTable extends AbstractDataTable
{
/**
* {@inheritdoc}
*/
protected $model = Role::class;
protected $transformer = RoleTransformer::class;
* Display ajax response.
*
* @return \Illuminate\Http\JsonResponse
public function ajax()
return $this->datatables
->eloquent($this->query())
->setTransformer(new $this->transformer)
->orderColumn('name', 'name->"$.'.app()->getLocale().'" $1')
->make(true);
}
* Get columns.
* @return array
array<string,array>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
protected function getColumns()
return [
'name' => ['title' => trans('cortex/fort::common.name'), 'render' => '"<a href=\""+routes.route(\'backend.roles.edit\', {role: full.id})+"\">"+data+"</a>"', 'responsivePriority' => 0],
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
'created_at' => ['title' => trans('cortex/fort::common.created_at'), 'width' => '15%', 'render' => "moment(data).format('MMM Do, YYYY')"],
'updated_at' => ['title' => trans('cortex/fort::common.updated_at'), 'width' => '15%', 'render' => "moment(data).format('MMM Do, YYYY')"],
];
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.