for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Controllers\Admin;
use Backpack\CRUD\app\Http\Controllers\CrudController;
// Validation
use App\Http\Requests\SkillCrudRequest as StoreRequest;
use App\Http\Requests\SkillCrudRequest as UpdateRequest;
class SkillCrudController extends CrudController
{
public function setup()
$this->crud->setModel("App\Models\Skill");
$this->crud->setRoute("admin/skill");
$this->crud->setEntityNameStrings('skill', 'skills');
$this->crud->addColumn([
'name' => 'name',
'type' => 'text',
'label' => 'Name'
]);
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:
someFunctionCall( $firstArgument, $secondArgument, $thirdArgument ); // Closing parenthesis on a new line.
'name' => 'description',
'label' => 'Description'
'name' => 'skill_type.name',
'label' => 'Type'
$this->crud->addField([
'label' => "Name"
'type' => 'textarea',
'label' => "Description"
'label' => "Type",
'type' => 'select',
'name' => 'skill_type_id', // the db column for the foreign key
'entity' => 'skill_type', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
}
public function store(StoreRequest $request)
$request
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function store(/** @scrutinizer ignore-unused */ StoreRequest $request)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return parent::storeCrud();
public function update(UpdateRequest $request)
public function update(/** @scrutinizer ignore-unused */ UpdateRequest $request)
return parent::updateCrud();