Credits#98
Merged
Merged
Conversation
Eager-load authEnrollment and lesson counts on the dashboard; use a configurable placeholder when course media is missing so image_url is always a string. Course card uses lessons_count and loads credit relations only when credits are enabled. Made-with: Cursor
The onerror handler in course-card.blade.php already falls back to the academic cap icon, so the placeholder URL was never visible in the UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… route gating, Livewire v4 compat - Restore string return type on getImageUrlAttribute with placeholder fallback - Remove unused hasValidCourseImage() and its Storage import - Cache completion_percentage in blade to avoid duplicate DB queries per card - Gate CreditCategoryResource route registration behind credits_enabled config - Add #[Computed] to getFilteredCoursesProperty for Livewire v4 compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename getFilteredCoursesProperty() to filteredCourses() so the Livewire v3 #[Computed] attribute properly registers the property instead of relying on legacy v2 backward compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Larastan and PHPStan dev branches are incompatible — minimum-stability: dev without prefer-stable caused CI to resolve bleeding-edge dev versions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Let the Blade onerror handler show the academic cap icon instead of falling back to a random stock photo when no course image is uploaded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds COLORS constant (16 Tailwind color names mapped to hex), hexColor(), badgeStyle(), and nextAvailableColor() methods. Adds color Select field and color badge column to CreditCategoryResource. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…table Add disableOptionsWhenSelectedInSiblingRepeaterItems() to credit category select to prevent duplicate entry SQL errors. Add dynamic color to credit category badges in the course table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The migration defaulted color to 'gray' which isn't a valid key in CreditCategory::COLORS, causing issues with the form Select dropdown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The UI handles missing course images with an icon, so the config fallback to course_image_placeholder_url is dead code. Updated tests to expect null when no media is attached. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add 'any' option to credit category filter on Dashboard and CourseResource to show courses with at least one credit category - Extract credit-badge Blade component with backdrop-blur for readability - Use Color::hex() for badge colors instead of Color::all() lookup - Remove unused badgeStyle() method from CreditCategory model - Lighten course card fallback background from gray-300 to gray-100 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces JS onerror approach with always-rendered fallback icon as base layer and absolutely-positioned image on top. Handles null URLs (skips img tag) and broken URLs (visibility hidden on error). Works reliably across Livewire re-renders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ering - Add CreditCategory and CourseCreditCategory factories - Update credit category migration stubs with full schema - Add relationships and config for credit category models - Update dashboard with credit category filtering and improved layout - Add CreditCategoryResource admin configuration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Str::beforeLast instead of Str::before to handle category names containing colons, and consolidate the duplicated color callback into a reusable static method on CreditCategory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The steps collection is already verified non-empty above, so first() cannot return null here. The ?? fallback handles the null case. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Step::progress() relationship is scoped to Auth::id(), so using it when $userId differs from the authenticated user returns incorrect data. Add the same guard used by completedByUserAt to fall through to the StepUser query for other users. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Color::hex() returns array<int, string> (shade palette), not array{int, int, int} (RGB tuple).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…cache The static $hexMap persisted across the entire PHP process lifetime, meaning changes to credit categories wouldn't reflect in badge colors until the process restarted (Octane, queue workers). Laravel's once() helper caches per-request and flushes automatically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds optional credits support: config (credits_enabled, credits_label), credit categories model and resource, course–credit category pivot, dashboard/course-card credits display, and migration stubs.
Made with Cursor
Note
Medium Risk
Introduces new persisted data (credit categories and course-credit mappings) plus new dashboard filtering and eager-loading changes; main risk is migration/relationship correctness and performance regressions on course lists.
Overview
Adds an optional “credits” feature flag (
filament-lms.credits_enabled) that, when enabled, lets admins defineCreditCategoryrecords and assign per-course credits via a newlms_course_credit_categoryrelationship.Updates the LMS UI and admin to surface credits: course cards now render a resilient image fallback plus credit badges, the dashboard adds a credit-category filter and uses computed
courses/filteredCourses, andCourseResourcegains a credits repeater, credits summary column, and a credit-category table filter. Registers the newCreditCategoryResourceonly when credits are enabled.Improves course list performance by eager-loading
lessons_count, step progress, and a newauthEnrollmentpivot relation to avoid per-coursecompleted_atqueries; also changesCourse::image_urlto returnnullwhen no media (tests/docs updated accordingly).Written by Cursor Bugbot for commit 9848261. This will update automatically on new commits. Configure here.