TechStore Explorer ships two distinct authentication layers: a Livewire-powered web experience for browser users and Laravel Sanctum for machine-to-machine REST API access. Both layers share the sameDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Emmanuel-Mtz-777/TechStore-Explorer/llms.txt
Use this file to discover all available pages before exploring further.
users table and role system, but they use different guards and credential flows.
Web Authentication
The web UI is built on Laravel Breeze (Livewire stack). Breeze provides a complete set of pre-built authentication views and Livewire form components out of the box.Register
New accounts are created via the Breeze registration form. Every new user is automatically assigned the
customer role.Login
The
LoginForm Livewire form object handles credential validation, rate-limiting (max 5 attempts), and session creation. After a successful login, users are redirected to the main product listing.Email Verification
Routes requiring the
verified middleware redirect unverified users to the email verification notice page until they confirm their address.Password Reset & Confirmation
Breeze includes password reset (via emailed link) and password confirmation flows. Profile management is available at
GET /profile.routes/auth.php, which is required at the bottom of routes/web.php.
Login rate limiting
TheLoginForm class enforces a maximum of 5 failed attempts before locking out the IP/email pair. Lock-out duration is determined by Laravel’s RateLimiter, and the throttle key combines the lowercased email with the client IP address.
Role-Based Access Control
TechStore Explorer uses a simple two-role model seeded into theroles table.
Seeded roles
| Role | Assigned to | Access |
|---|---|---|
admin | Manually promoted users | Dashboard + all /api/roles/* endpoints |
customer | All new registrations (web & API) | Standard authenticated routes |
Middleware
Two custom middleware classes enforce role-based access:AdminMiddleware — used for web routes. Checks that the authenticated user’s role name is admin; aborts with 403 otherwise (or 401 if not authenticated at all).
AdminApiMiddleware — used for API routes. Returns a JSON 403 response for non-admin users so API consumers receive a machine-readable error instead of an HTML error page.
Protected routes
| Route | Middleware stack | Description |
|---|---|---|
GET /dashboard | auth, verified, admin | Admin analytics dashboard |
GET /api/roles/* | auth:sanctum, admin.api | Role management API endpoints |
User Model
TheUser model uses three key traits that enable both authentication layers:
| Trait | Purpose |
|---|---|
HasApiTokens | Enables Sanctum personal access token creation and validation |
Notifiable | Allows sending email notifications (password reset, etc.) |
HasFactory | Provides model factory support for tests and seeders |
name, email, password, role_id
Hidden fields: password, remember_token
Relationships:
role()→belongsTo(Role::class)— the user’s assigned rolewishlists()→hasMany(Wishlist::class)— all wishlist entries for this user
Test Accounts
The following seeded accounts are available in a freshly migrated development environment:| Password | Role | |
|---|---|---|
admin@example.com | admin123 | admin |
test@example.com | customer123 | customer |