This commit is contained in:
James Cole
2020-05-07 06:44:01 +02:00
parent 2101717edb
commit 43d7c956a4
19 changed files with 209 additions and 29 deletions

View File

@@ -138,10 +138,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property-read int|null $transactions_count
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\User whereMfaSecret($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\User whereObjectguid($value)
* @property string $password
* @property bool $blocked
* @property string|null $blocked_code
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Role[] $roles
*/
class User extends Authenticatable
{
@@ -217,6 +213,16 @@ class User extends Authenticatable
return $this->hasMany(Attachment::class);
}
/**
* @param string $role
*
* @return bool
*/
public function hasRole(string $role): bool
{
return $this->roles()->where('name', $role)->count() === 1;
}
/**
* @codeCoverageIgnore
* Link to available budgets