for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Fireworkweb\Gates\Traits;
trait HasGates
{
public function gateAllows()
return true;
}
public function gateAllowsGuests($user = null)
$user
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
public function gateDenies()
return false;
public function gateDeniesGuests($user = null)
protected static function gateRouteName(): string
// @TODO: add magic way
return '';
protected static function gateAbilities(): array
return [];
protected static function gateResourceAbilities(): array
return [
'index' => 'index',
'create' => 'create',
'store' => 'store',
'show' => 'show',
'edit' => 'edit',
'update' => 'update',
'destroy' => 'destroy',
];
public static function gateRegister(): void
gate()->resource(
static::gateRouteName(),
static::class,
static::gateAbilities()
);
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.