Bristol SU Support Package
Public Member Functions | Static Public Member Functions | List of all members
BristolSU\Support\Authentication\HasResource Class Reference

Public Member Functions

 scopeForResource (Builder $query, $activityInstanceId=null, $moduleInstanceId=null)
 
 scopeForModuleInstance (Builder $query, $moduleInstanceId=null)
 

Static Public Member Functions

static bootHasResource ()
 
static moduleInstanceId ()
 
static activityInstanceId ()
 

Detailed Description

Adds features for Module Instance and Activity Instance id references

static Builder forResource(int $activityInstanceId = null, int $moduleInstanceId = null) static Builder forModuleInstance(int $moduleInstanceId = null)

Definition at line 16 of file HasResource.php.

Member Function Documentation

◆ activityInstanceId()

static BristolSU\Support\Authentication\HasResource::activityInstanceId ( )
static

Returns the resolved activity instance

Returns
int

Definition at line 52 of file HasResource.php.

◆ bootHasResource()

static BristolSU\Support\Authentication\HasResource::bootHasResource ( )
static

Boot the trait

When a model is saved, if activity_instance_id or module_instance_id are null they will be set to the id of the model resolved from the container.

Definition at line 25 of file HasResource.php.

◆ moduleInstanceId()

static BristolSU\Support\Authentication\HasResource::moduleInstanceId ( )
static

Returns the module instance resolved from the container

Returns
int

Definition at line 43 of file HasResource.php.

◆ scopeForModuleInstance()

BristolSU\Support\Authentication\HasResource::scopeForModuleInstance ( Builder  $query,
  $moduleInstanceId = null 
)

Return all models for the current module instance

A scope for the admin side of a module, where it returns all models which are associated to the current module instance

Parameters
Builder$query
null$moduleInstanceId

Definition at line 84 of file HasResource.php.

◆ scopeForResource()

BristolSU\Support\Authentication\HasResource::scopeForResource ( Builder  $query,
  $activityInstanceId = null,
  $moduleInstanceId = null 
)

Retrieves models for the current user

A scope to select only items which have the module instance and activity as are being used. Use on the participant side of modules to quickly retrieve models accessible by the user.

Make sure to create two unsignedBigInt rows on the table called 'activity_instance_id' and 'module_instance_id'

Parameters
Builder$query
Exceptions

Definition at line 70 of file HasResource.php.


The documentation for this class was generated from the following file: