Bristol SU Support Package
Public Member Functions | List of all members
BristolSU\Support\Activity\Repository Class Reference
Inheritance diagram for BristolSU\Support\Activity\Repository:
Inheritance graph
[legend]
Collaboration diagram for BristolSU\Support\Activity\Repository:
Collaboration graph
[legend]

Public Member Functions

 getForAdministrator (?User $user=null, ?Group $group=null, ?Role $role=null)
 
 active ()
 
 getForParticipant (?User $user=null, ?Group $group=null, ?Role $role=null)
 
 all ()
 
 create (array $attributes)
 
 getById ($id)
 
 update ($id, $attributes)
 
 delete ($id)
 

Detailed Description

Activity Repository implementation using Eloquent

Definition at line 16 of file Repository.php.

Member Function Documentation

◆ active()

BristolSU\Support\Activity\Repository::active ( )

Retrieve all active activities.

This method should return all activities that're currently active. This currently just means they are within their active timeframe and they're turned on,

Returns
Collection

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 45 of file Repository.php.

Referenced by BristolSU\Support\Activity\Repository\getForAdministrator(), and BristolSU\Support\Activity\Repository\getForParticipant().

◆ all()

BristolSU\Support\Activity\Repository::all ( )

Return all activities

Returns
Collection

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 80 of file Repository.php.

◆ create()

BristolSU\Support\Activity\Repository::create ( array  $attributes)

Create an activity

Create an activity using the given attributes. The attributes can be taken from the following: [ 'name' => 'Activity Name', 'description' => 'Activity Description', 'activity_for' => 'user', 'for_logic' => '1', 'admin_logic' => 2, 'start_date' => null, 'end_date' => null, 'slug' => 'activity-slug', 'type' => 'open', 'enabled' => true ]

Parameters
array$attributesArray of attributes to create the activity with
Returns
Activity

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 105 of file Repository.php.

◆ delete()

BristolSU\Support\Activity\Repository::delete (   $id)

Delete an activity by ID

Parameters
int$idID of the activity
Returns
void
Exceptions

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 162 of file Repository.php.

References BristolSU\Support\Activity\Repository\getById().

◆ getById()

BristolSU\Support\Activity\Repository::getById (   $id)

Get an activity by ID

Parameters
int$idID of the activity
Returns
Activity
Exceptions
ModelNotFoundException

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 119 of file Repository.php.

Referenced by BristolSU\Support\Activity\Repository\delete(), and BristolSU\Support\Activity\Repository\update().

◆ getForAdministrator()

BristolSU\Support\Activity\Repository::getForAdministrator ( ?User  $user = null,
?Group  $group = null,
?Role  $role = null 
)

Return all admin activities for a user

Return all the admin for which the given user, group and role satisfy the forLogic group.

Parameters
User | null$user
Group | null$group
Role | null$role
Returns
Collection

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 29 of file Repository.php.

References BristolSU\Support\Activity\Repository\active().

◆ getForParticipant()

BristolSU\Support\Activity\Repository::getForParticipant ( ?User  $user = null,
?Group  $group = null,
?Role  $role = null 
)

Return all participant activities for a user

Return all the activities for which the given user, group and role satisfy the forLogic group.

Parameters
User | null$user
Group | null$group
Role | null$role
Returns
Collection

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 67 of file Repository.php.

References BristolSU\Support\Activity\Repository\active().

◆ update()

BristolSU\Support\Activity\Repository::update (   $id,
  $attributes 
)

Update an activity

Update an activity using the given attributes. The attributes can be taken from the following: [ 'name' => 'Activity Name', 'description' => 'Activity Description', 'activity_for' => 'user', 'for_logic' => '1', 'admin_logic' => 2, 'start_date' => null, 'end_date' => null, 'slug' => 'activity-slug', 'type' => 'open', 'enabled' => true ]

Parameters
$id
$attributes
Returns
Activity
Exceptions
ModelNotFoundException

Implements BristolSU\Support\Activity\Contracts\Repository.

Definition at line 146 of file Repository.php.

References BristolSU\Support\Activity\Repository\getById().


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