for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yaro\Jarboe\Http\Controllers\Traits\Handlers;
use Illuminate\Http\Request;
use Spatie\Permission\Exceptions\UnauthorizedException;
use Yaro\Jarboe\Table\CRUD;
trait ListHandlerTrait
{
protected $viewCrudList = 'jarboe::crud.list';
/**
* Show table list page.
*
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws UnauthorizedException
*/
public function handleList(Request $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 handleList(/** @scrutinizer ignore-unused */ Request $request)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$this->beforeInit();
$this->init();
$this->bound();
if (!$this->can('list')) {
throw UnauthorizedException::forPermissions(['list']);
}
return view($this->viewCrudList, [
'crud' => $this->crud(),
'items' => $this->crud()->repo()->get(),
'viewsAbove' => $this->getListViewsAbove(),
'viewsBelow' => $this->getListViewsBelow(),
]);
* Get array of view's objects, that should be rendered above content of `list` view.
* @return array
protected function getListViewsAbove(): array
return [];
* Get array of view's objects, that should be rendered below content of `list` view.
protected function getListViewsBelow(): array
abstract protected function beforeInit();
abstract protected function init();
abstract protected function bound();
abstract protected function crud(): CRUD;
abstract protected function can($action): bool;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.