Bristol SU Support Package
ActionInstanceRepository.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
10 {
11 
15  public function forEvent(int $moduleInstanceId, string $event): Collection
16  {
17  return ActionInstance::where('module_instance_id', $moduleInstanceId)
18  ->where('event', $event)
19  ->get();
20  }
21 
28  public function forModuleInstance(int $moduleInstanceId): Collection
29  {
30  return ActionInstance::where('module_instance_id', $moduleInstanceId)->get();
31  }
32 
41  public function getById(int $id): ActionInstance
42  {
43  return ActionInstance::findOrFail($id);
44  }
45 
50  public function all(): Collection
51  {
52  return ActionInstance::all();
53  }
54 
64  public function update(int $id, array $attributes): ActionInstance
65  {
66  $actionInstance = $this->getById($id);
67  $actionInstance->fill($attributes);
68  $actionInstance->save();
69  return $actionInstance;
70  }
71 
81  public function delete(int $id)
82  {
83  $actionInstance = $this->getById($id);
84  $actionInstance->delete();
85  }
86 
87 
88 }