PHPackages                             tapp/filament-lms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. tapp/filament-lms

ActiveLibrary[Admin Panels](/categories/admin)

tapp/filament-lms
=================

v4.5.0(2w ago)193.4k↓51.1%4[1 PRs](https://github.com/TappNetwork/Filament-LMS/pulls)MITPHPPHP ^8.3CI passing

Since Aug 23Pushed 3w ago4 watchersCompare

[ Source](https://github.com/TappNetwork/Filament-LMS)[ Packagist](https://packagist.org/packages/tapp/filament-lms)[ RSS](/packages/tapp-filament-lms/feed)WikiDiscussions 4.x Synced today

READMEChangelog (10)Dependencies (81)Versions (61)Used By (0)

Filament LMS
============

[](#filament-lms)

An opinionated LMS plugin for Filament containing a user facing LMS panel and Resources for an existing admin panel

Version Compatibility
---------------------

[](#version-compatibility)

FilamentFilament LMSDocumentation4.x/5.x4.xCurrent3.x1.x[Check the docs](https://github.com/TappNetwork/Filament-LMS/tree/1.x)Installation
------------

[](#installation)

### Add the following to composer.json

[](#add-the-following-to-composerjson)

```
"minimum-stability": "dev"
```

```
"repositories": {
    "tapp/filament-lms": {
        "type": "vcs",
        "url": "https://github.com/tappnetwork/filament-lms"
    },
    "tapp/filament-form-builder": {
        "type": "vcs",
        "url": "https://github.com/tappnetwork/filament-form-builder"
    }
},
```

or

```
{
"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/tappnetwork/filament-lms"
        },
        {
            "type": "vcs",
            "url": "https://github.com/TappNetwork/Filament-Form-Builder"
        }
    ],
}
```

```
composer require tapp/filament-lms:"^4.0"
```

### Publish

[](#publish)

Make sure that the [Filament Form Builder](https://github.com/TappNetwork/Filament-Form-Builder) migrations are published before.

Then publish the migrations:

```
php artisan vendor:publish --provider="Tapp\FilamentLms\FilamentLmsServiceProvider"
```

Warning

If you are using multi-tenancy, please see the "Multi-Tenancy Support" section below **before** running migrations.

run migrations after publishing

### Add plugin to admin panel

[](#add-plugin-to-admin-panel)

This will create resources that allow admin to manage course material.

```
class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->plugins([
                \Tapp\FilamentLms\Lms::make(),
            ])
    }
}
```

### Tailwind CSS Setup

[](#tailwind-css-setup)

This package uses Tailwind CSS classes in its Blade views. The configuration differs between Tailwind v3 and v4:

#### For Tailwind CSS v3

[](#for-tailwind-css-v3)

1. **Install Tailwind CSS** in your project (if not already installed):

```
npm install -D tailwindcss
npx tailwindcss init
```

2. **Configure Tailwind** to include the package's views in your `tailwind.config.js`:

```
module.exports = {
  content: [
    // ... your existing content paths
    './vendor/tapp/filament-lms/resources/views/**/*.blade.php',
    './vendor/tapp/filament-form-builder/resources/views/**/*.blade.php',
  ],
  // ... rest of your config
}
```

3. **Include the package CSS** in your main CSS file (e.g., `resources/css/app.css`):

```
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

/* Import the LMS package styles */
@import '../../vendor/tapp/filament-lms/dist/filament-lms.css';
```

4. **Build your CSS** to include both Tailwind and the package styles:

```
npm run build
```

#### For Tailwind CSS v4

[](#for-tailwind-css-v4)

1. **Install Tailwind CSS v4** in your project:

```
npm install -D @tailwindcss/vite@next
```

2. **Include the package CSS** in your main CSS file (e.g., `resources/css/app.css` or `resources/css/theme.css`):

```
@import "tailwindcss";

/* Import the LMS package styles */
@import '../../vendor/tapp/filament-lms/dist/filament-lms.css';
```

3. **Build your CSS** to include both Tailwind and the package styles:

```
npm run build
```

**Note:** The package provides its own CSS for component-specific styling, while using Tailwind classes in views for layout and utilities. This approach ensures no dependency conflicts while maintaining the benefits of Tailwind CSS.

For more detailed Tailwind CSS configuration options, refer to the [official Tailwind CSS documentation](https://tailwindcss.com/docs).

Development Reccomendations
===========================

[](#development-reccomendations)

- create the directory {project}/packages
- from within the packages directory, clone this repo
- (if necessary) add a type:path repository to project composer.json

Multi-Tenancy Support
---------------------

[](#multi-tenancy-support)

Filament LMS includes built-in support for multi-tenancy, allowing you to scope courses, lessons, steps, and all learning materials to specific tenants (e.g., teams, organizations, workspaces).

### ⚠️ Important: Enable Tenancy Before Migrations

[](#️-important-enable-tenancy-before-migrations)

**You MUST configure and enable tenancy in the config file BEFORE running the migrations.** The migrations check the tenancy configuration to determine whether to add tenant columns to the database tables. If you enable tenancy after running migrations, you'll need to manually add the tenant columns to your database.

### Quick Setup

[](#quick-setup)

1. **Configure tenancy in `config/filament-lms.php` BEFORE running migrations:**

```
'tenancy' => [
    'enabled' => true,
    'model' => \App\Models\Team::class,
    'relationship_name' => 'team', // optional
    'column' => 'team_id', // optional
],
```

2. **Run migrations** (which will now include tenant columns):

```
php artisan migrate
```

3. **Implement required contracts on your User model:**

```
use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasTenants;
use Filament\Panel;
use Illuminate\Support\Collection;

class User extends Authenticatable implements FilamentUser, HasTenants
{
    // Allow users to access the LMS panel
    public function canAccessPanel(Panel $panel): bool
    {
        return true; // Or add custom logic
    }

    // Define the teams relationship
    public function teams(): BelongsToMany
    {
        return $this->belongsToMany(Team::class);
    }

    // Return all teams the user can access
    public function getTenants(Panel $panel): Collection
    {
        return $this->teams;
    }

    // Check if user can access a specific team
    public function canAccessTenant(Model $tenant): bool
    {
        return $this->teams()->whereKey($tenant)->exists();
    }
}
```

4. **Implement HasName contract on your Tenant model:**

```
use Filament\Models\Contracts\HasName;

class Team extends Model implements HasName
{
    public function getFilamentName(): string
    {
        return $this->name;
    }
}
```

### How It Works

[](#how-it-works)

Once tenancy is enabled:

**URL Structure Changes:**

- LMS URLs are now scoped to tenants: `/lms/{tenant}/...`
- Example: `/lms/acme-corp/courses`, `/lms/acme-corp/certificates/...`
- The `{tenant}` slug is automatically determined from your tenant model's route key

**Data Scoping:**

- All LMS queries are automatically scoped to the current tenant
- New courses, lessons, and materials are automatically associated with the current tenant
- Users can only access LMS content belonging to their current tenant

**Permission Checking:**

- Filament automatically verifies users have access to the tenant via `canAccessTenant()`
- Users can only see tenants returned by `getTenants()`
- Panel access is controlled by `canAccessPanel()`

LMS Features
============

[](#lms-features)

Frontend LMS Panel
------------------

[](#frontend-lms-panel)

contains the LMS experience for the end user

### Course Library

[](#course-library)

- user can view courses available to them
- completion status

### Course UI

[](#course-ui)

- shown when progressing through a single course
- left sidebar showing lessons with steps expanding from them
- icons in sidebar indicating the type of material for each step
- middleware to resume current step
- middleware to prevent skipping steps

### Other Frontend

[](#other-frontend)

- profile
- anything else?

Admin Plugin
------------

[](#admin-plugin)

(should these be resource groups in existing panel or its own panel?)

### LMS resource group contains the following resources:

[](#lms-resource-group-contains-the-following-resources)

#### Course

[](#course)

- Top level of learning material data structure
- courses do not have an order. they are independant
- courses can be public or invite only

#### Lesson

[](#lesson)

- Intermediary level data structure
- Has Order (e.g. lesson 1 must be completed before starting lesson 2)
- *in the future* we may want to add support for lessons containing lessons to allow clients more customizability (lesson 1 contains lesson 1.1)
- name optional

#### Step

[](#step)

- Represents a single view in the LMS
- has order
- has material
- name optional

### Material Resource Group

[](#material-resource-group)

- Video (do we use vimeo or something else?)
- Survey (form for student to fill out)
- Quiz (unlike a survey, a quiz has correct answers and a score)
- Text (Wysiwyg?)
- Image

Configurations
--------------

[](#configurations)

This is the contents of the published config file:

```
