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\Ability;
use Cortex\Foundation\DataTables\AbstractDataTable;
use Cortex\Fort\Transformers\Backend\AbilityTransformer;
class AbilitiesDataTable extends AbstractDataTable
{
/**
* {@inheritdoc}
*/
protected $model = Ability::class;
protected $transformer = AbilityTransformer::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')
->orderColumn('slug', 'action $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.abilities.edit\', {ability: 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.
'slug' => ['title' => trans('cortex/fort::common.slug')],
'policy' => ['title' => trans('cortex/fort::common.policy')],
'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.