Skip to content

Commit

Permalink
Merge pull request UnlockedLabs#225 from chrissantillan/Store-Canvas-…
Browse files Browse the repository at this point in the history
…Courses-Controller-refactor

fix UnlockedLabs#224: implement `getProviderServices` to get Canvas service
  • Loading branch information
PThorpe92 authored Apr 23, 2024
2 parents f50d8ef + 3643eb2 commit be547e3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/Http/Controllers/v1/Actions/StoreCanvasCoursesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@
use App\Http\Requests\AdminRequest;
use App\Http\Resources\CourseResource;
use App\Models\Course;
use App\Services\CanvasServices;
use App\Models\ProviderPlatform;

class StoreCanvasCoursesController extends Controller
{
public function __invoke(AdminRequest $request)
{
try {
$canvasService = CanvasServices::byProviderId($request['provider_platform_id']);
} catch (\Exception) {
return response()->json(['message' => 'Provider not found'], 404);
}
$provider = ProviderPlatform::findOrFail($request['provider_platform_id']);
$canvas = $provider->getProviderServices();
// list all the courses in the account
$canvasCourses = $canvasService->listCourses();
$canvasCourses = $canvas->listCourses();
$courseCollection = collect();
foreach ($canvasCourses as $course) {
if (isset($course['public_description'])) {
Expand Down

0 comments on commit be547e3

Please sign in to comment.