Authentication and user management on Laravel, built on Breeze and extended into something an admin can actually operate: role management, a structured audit trail, and a log you can filter and export.
Breeze gives you sign-up and sign-in. This project adds the part that usually gets skipped in a portfolio build: who changed what, when, and for whom, with the values recorded rather than buried in a sentence.
| Landing | Sign in |
|---|---|
![]() |
![]() |
| Admin dashboard | User management |
|---|---|
![]() |
![]() |
| User detail | Activity log |
|---|---|
![]() |
![]() |
| Layer | Choice |
|---|---|
| Framework | Laravel 13 (PHP 8.3+) |
| Auth scaffold | Laravel Breeze 2 |
| Database | MySQL in development, SQLite in-memory for tests |
| Front end | Blade, Tailwind CSS 3, Alpine.js, Vite |
| Tests | PHPUnit 12, RefreshDatabase feature tests |
| Code style | Laravel Pint |
- Registration, login, logout, remember-me
- Email verification (routes behind
verifiedmiddleware) - Forgot password and password reset
- Login throttling, plus
throttle:5,1on registration and forgot-password - Password policy: minimum 10 characters, mixed case, numbers, symbols, and
checked against known-breached passwords (
uncompromised)
- Update name, email, and avatar; email re-verification when the address changes
- Change password
- Delete account, which also deletes the stored avatar file
- Separate admin layout with a responsive sidebar and skip link
- Dashboard with user counts and recent registrations
- User list with search by name or email (pagination keeps the filter)
- User detail page: profile summary, role form, and every audit event the account is involved in, either as actor or as target
- Role change requires password confirmation, is validated against
in:user,admin, and refuses to change your own role - Activity log with filters by event and by actor, and CSV export that respects the active filters
Every event stores actor, actor email snapshot, target user, old value, new value, description, IP address, and user agent:
| Event | When |
|---|---|
User Registered |
account created |
User Login |
successful sign-in |
User Logout |
sign-out |
Login Failed |
failed attempt (recorded from the Failed auth event) |
Email Verified |
verification link used |
Password Changed |
user changed their own password |
Profile Updated |
name, email, or avatar changed |
Role Changed |
admin changed a role, with old_value and new_value |
Account Deleted |
user deleted their own account |
The actor_email column is a deliberate denormalisation: the foreign key is
nullOnDelete, so a deleted user would otherwise leave the trail unreadable.
- Admin routes sit behind
['auth', 'verified', 'admin'], and the admin panel is linked from the main navigation for admins only. password.confirmguards the role-change action rather than the whole admin group, so routine admin pages do not re-prompt on every click.- Role changes are validated, self-changes are rejected server-side, and the UI disables the control on your own account.
- Uploaded avatars live on the
publicdisk and are removed when the account is deleted; storage URLs are built withStorage::disk('public')->url()everywhere. - Passwords are hashed with the framework default;
.envis never committed.
users
| Column | Notes |
|---|---|
id, name, email, password |
standard |
role |
enum('user','admin'), default user |
avatar |
nullable path on the public disk |
email_verified_at, timestamps |
standard |
activity_logs
| Column | Notes |
|---|---|
user_id |
actor, nullOnDelete |
actor_email |
snapshot of the actor address |
target_user_id |
subject of the action, nullOnDelete |
action |
event name, indexed |
old_value, new_value |
structured change, used for role changes |
description |
human-readable detail |
ip_address, user_agent |
request context, user agent truncated to 255 chars |
git clone https://github.com/Amiya23/SecureAuth.git secureauth
cd secureauth
composer install
npm install
cp .env.example .env
php artisan key:generateSet the database credentials in .env, then:
php artisan migrate --seed
php artisan storage:link--seed creates demo accounts so the admin tables are not empty:
| Account | Password | Role |
|---|---|---|
[email protected] |
SecureAuth2026! |
admin |
[email protected] |
SecureAuth2026! |
admin |
[email protected] |
SecureAuth2026! |
user |
These are local demo credentials only. Change or delete them before exposing the app anywhere.
Run the app:
composer devThat starts the PHP server, queue listener, log viewer, and Vite together. Or run
php artisan serve and npm run dev separately.
php artisan testTests use SQLite in-memory (see phpunit.xml), so no database setup is needed. The
suite covers authentication, email verification, password reset and update, profile
updates and account deletion, admin access rules (including unverified admins and
password confirmation), user search, role changes with their audit entry, activity
log filters, CSV export, and failed-login logging.
Code style:
vendor/bin/pint --test # check
vendor/bin/pint # fixCI runs the same gates on every push and pull request: dependency install, asset
build, Pint check, and the test suite. See .github/workflows/ci.yml.
app/
Http/Controllers/Admin/ dashboard, user management, activity log
Http/Middleware/ admin gate
Models/ User, ActivityLog
Services/ ActivityLogService (single write path for events)
database/
migrations/ schema, including structured activity log columns
seeders/ demo accounts and sample audit events
resources/views/
admin/ admin layout, users, activity logs
auth/, profile/ Breeze screens
tests/Feature/ feature tests for every route above
- No two-factor authentication.
- No soft deletes; deleting a user removes the account and keeps the audit rows with a null actor.
- The activity log grows without pruning; retention would need a scheduled job.
- No static analysis in CI yet (PHPStan/Larastan would be the next gate).
MIT.





