Skip to content

Commit

Permalink
fix: allow school to be variable
Browse files Browse the repository at this point in the history
  • Loading branch information
fredbradley committed Sep 16, 2022
1 parent 66b5fd9 commit 7a23329
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Wrappers/Lesson.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace spkm\isams\Wrappers;

use Illuminate\Support\Collection;
use spkm\isams\Contracts\Institution;
use spkm\isams\Controllers\RoughAndReadyController;
use spkm\isams\Wrapper;

Expand All @@ -11,6 +12,16 @@
*/
class Lesson extends Wrapper
{
/**
* @param $item
* @param \spkm\isams\Contracts\Institution $institution
*/
public function __construct($item, Institution $institution)
{
$this->institution = $institution;
parent::__construct($item);
}

/**
* Handle the data.
*
Expand All @@ -37,7 +48,7 @@ protected function handle(): void
*/
private function getPupilsInSet(int $setId): Collection
{
$api = new RoughAndReadyController(\App\School::find(2));
$api = new RoughAndReadyController($this->institution);

return collect($api->get('teaching/sets/' . $setId . '/setList')->students)->pluck('schoolId');
}
Expand Down

0 comments on commit 7a23329

Please sign in to comment.