Skip to content

Commit b629f98

Browse files
docs: remove FILAMENT_ADMIN_AUTH documentation as it is no longer needed; update README to reflect changes in admin authentication structure
1 parent fa18584 commit b629f98

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Course Hub
22

3+
> **Filament admin authentication:** this repo keeps Filament admins on a separate **`admins`** table and **`admin`** guard from student **`users`** / **`web`**. Background, security rationale, and setup: **[`docs/FILAMENT_ADMIN_AUTH.md`](docs/FILAMENT_ADMIN_AUTH.md)**.
4+
35
A Laravel-based Learning Management System featuring a **student-facing course experience** and a **Filament-powered admin panel**.
46

57
- 🎓 Browse courses, enroll, and track lesson progress
@@ -18,6 +20,7 @@ Follow these steps to get the project running locally.
1820

1921
```bash
2022
git clone https://github.com/mahmoudmohamedramadan/course-hub course-hub
23+
2124
cd course-hub
2225
```
2326

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22

33
## Why this exists
44

5-
The app originally relied on a single `users` table for authentication. When wiring Filament, **installer-style flows and user-creation tooling** typically persist accounts using whatever Eloquent model your panel is configured to use. If that model is the same as your students (`User`), new “admins” land in `users` alongside normal accounts.
5+
The app originally used a single users table for authentication. When setting up Filament, creating an admin also stored it in the same table.
66

7-
That coupling creates real problems:
7+
This causes problems:
88

9-
- **Privilege overlap**the same identity can satisfy both “logged-in student” and “Filament session” expectations unless you add strict, easy-to-miss guards everywhere.
10-
- **Harder reasoning**authorization and policies must constantly branch on “is this row an admin or a student?”.
11-
- **Higher blast radius**bugs in role checks or route middleware can expose admin capabilities to the wrong account class.
9+
- **Privilege overlap**admins and users share the same access
10+
- **More complex logic**you must constantly check roles
11+
- **Security risk**mistakes can expose admin features to users
1212

13-
This project **splits authentication concerns**: students stay on the `web` guard and `users` table; Filament uses a dedicated **`admins` table** and **`admin` guard**.
13+
---
14+
15+
### Solution
16+
17+
- Users → `users` table with `web` guard
18+
- Admins → `admins` table with `admin` guard
1419

1520
---
1621

@@ -28,7 +33,9 @@ Adjust the migration to match the columns you need (at minimum `name`, `email`,
2833

2934
## 2. Admin model
3035

31-
Implement Filament’s `FilamentUser` contract (and any optional MFA interfaces your panel uses). Use the same attribute style as `App\Models\User` for fillable / hidden fields:
36+
Implement Filament’s `FilamentUser` contract (and any optional MFA interfaces your panel uses). Use the same attribute style as `App\Models\User` for fillable / hidden fields.
37+
38+
> For official guidance on implementing **`FilamentUser`** and **`canAccessPanel()`** (who may access the panel), see Filament’s documentation: [Users — Authorizing access to the panel](https://filamentphp.com/docs/5.x/users/overview#authorizing-access-to-the-panel). That page uses `App\Models\User` as an example; apply the same ideas to your **`Admin`** model.
3239
3340
```php
3441
<?php

0 commit comments

Comments
 (0)