Escola Headless LMS Courses

Installs: 1 997

Dependents: 5

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 16


0.3.7 2021-12-01 12:25 UTC


Courses and content package

swagger codecov phpunit downloads downloads downloads Maintainability

Model relation

The model user must be extended with the class HasCourses :

class User extends EscolaLms\Core\Models\User
    use HasCourses;

Database relation

There is simple relation. see docs for diagram

  1. Course general category of the course
  2. Lesson grouped by Course
  3. Topic grouped by Lesson
Course 1 -> n Lesson
Lesson 1 -> n Topic
Topic 1 -> 1 TopicContent

TopicContent is an abstract model, this package contains some sample implementatio eg, RichText, Audio, Video, H5P and Image

You create any of the Content model by post to the same Topic endponit (create and update), see docs examples

Note that /api/topics is using form-data - this is due to PHP nature of posting files

List of possible TopicContents is availabe in the endpoint /api/topics/types


App user access the course by fetching GET /api/courses/{id}/program endpoint. This is after user purchase or has other access to the course. this endpoints renders tree of Course, Lessons, Topic with Contents essential to render whole course.

Adding new TopicContent type

In the ServiceProvider register your class like

use Illuminate\Support\ServiceProvider;
use EscolaLms\Courses\Facades\Topic;

class CustomServiceProvider extends ServiceProvider


    public function register()
        // or
        Topic::registerContentClasses([TopicContentCustom::class, TopicAnotherContentCustom::class]);

        // also register JSON Resource for a type
        Topic::registerResourceClasses(Audio::class, [
            'client' => ClientAudioResource::class,
            'admin' => AdminAudioResource::class,
            'export' => ExportAudioResource::class,


see EscolaLmsCourseServiceProvider.php as reference as well as Models/TopicContent


Passport roles & permissions

Package comes with seeder that populate the permissions for to access administration endpoints.

php artisan db:seed --class="\EscolaLms\Courses\Database\Seeders\CoursesPermissionSeeder"

Above defined some roles and permissions. See the seeder and policy.


Package comes with seeder that create course with lessons and topics

php artisan db:seed --class="\EscolaLms\Courses\Database\Seeders\CoursesSeeder"