for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Terranet\Administrator\Auth;
use Illuminate\Contracts\Auth\Authenticatable;
class SuperAdminRule
{
public function validate(Authenticatable $user = null)
$user = $user ?: $this->userProvider();
if (!$user) {
return false;
}
if (method_exists($user, 'isSuperAdmin')) {
return \call_user_func([$user, 'isSuperAdmin']);
return 1 === (int) $user->getAuthIdentifier();
/**
* @return null|Authenticatable
*/
protected function userProvider()
return auth('admin')->user();
auth
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
return /** @scrutinizer ignore-call */ auth('admin')->user();