class ApiKey extends Model

Traits

SoftDeletes

Constants

EVENT_NAME_CREATED

EVENT_NAME_ACTIVATED

EVENT_NAME_DEACTIVATED

EVENT_NAME_DELETED

Properties

static protected $nameRegex
protected $table

Methods

static string
generate()

Generate a secure unique API key

static 
getByKey(string $key)

Get ApiKey record by key value

static bool
isValidKey(string $key)

Check if key is valid

static bool
isValidName(string $name)

Check if name is valid format

static bool
keyExists(string $key)

Check if a key already exists

static bool
nameExists(string $name)

Check if a name already exists

Details

at line 28
static string generate()

Generate a secure unique API key

Return Value

string

at line 42
static getByKey(string $key)

Get ApiKey record by key value

Parameters

string $key

at line 55
static bool isValidKey(string $key)

Check if key is valid

Parameters

string $key

Return Value

bool

at line 65
static bool isValidName(string $name)

Check if name is valid format

Parameters

string $name

Return Value

bool

at line 77
static bool keyExists(string $key)

Check if a key already exists

Includes soft deleted records

Parameters

string $key

Return Value

bool

at line 89
static bool nameExists(string $name)

Check if a name already exists

Does not include soft deleted records

Parameters

string $name

Return Value

bool