Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AlexanderDamont1/Stratus/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Stratus POS uses Laravel Eloquent for database interaction. Models live in app/Models/ and each maps to a database table.

User

File: app/Models/User.php The User model is the foundation of all authentication and user identity in Stratus. It extends Laravel’s Authenticatable base class, which provides everything needed to integrate with the authentication system.
app/Models/User.php
class User extends Authenticatable
{
    use HasFactory, Notifiable;

    protected $fillable = ['name', 'email', 'password'];
    protected $hidden = ['password', 'remember_token'];

    protected function casts(): array
    {
        return [
            'email_verified_at' => 'datetime',
            'password' => 'hashed',
        ];
    }
}

Traits

TraitPurpose
HasFactoryEnables User::factory() for generating test and seed data
NotifiableAllows sending notifications (email, SMS, etc.) to the user

Fillable attributes

These attributes can be mass-assigned via User::create() or $user->fill():
AttributeTypeNotes
namestringDisplay name
emailstringUnique email address
passwordstringAutomatically hashed (see casts)

Hidden attributes

These attributes are excluded from array/JSON serialization:
  • password — never exposed in API responses or logs
  • remember_token — used for “remember me” sessions

Casts

AttributeCastEffect
email_verified_atdatetimeReturns a Carbon instance instead of a raw string
passwordhashedAutomatically bcrypt-hashes the value on assignment
Because password is cast to hashed, you can assign a plain-text password directly — Laravel will hash it automatically:
$user->password = 'plain-text-password'; // stored as bcrypt hash

Database schema

users table

Created by database/migrations/0001_01_01_000000_create_users_table.php:
ColumnTypeNotes
idbigint unsignedPrimary key, auto-increment
namevarcharDisplay name
emailvarcharUnique
email_verified_attimestampNullable — null if not yet verified
passwordvarcharBcrypt hash
remember_tokenvarchar(100)Nullable
created_attimestampAuto-managed by Eloquent
updated_attimestampAuto-managed by Eloquent

password_reset_tokens table

ColumnTypeNotes
emailvarcharPrimary key
tokenvarcharHashed reset token
created_attimestampNullable

sessions table

ColumnTypeNotes
idvarcharPrimary key
user_idbigint unsignedNullable, foreign key to users
ip_addressvarchar(45)Nullable
user_agenttextNullable
payloadlongtextSession data
last_activityintegerUnix timestamp

UserFactory

Class: Database\Factories\UserFactory The factory generates User instances with realistic fake data for use in tests and seeders.
use App\Models\User;

// Create a persisted user with random attributes (email verified by default)
$user = User::factory()->create();

// Create a user with a specific email
$user = User::factory()->create(['email' => 'jane@example.com']);

// Create an unverified user (email_verified_at = null)
$user = User::factory()->unverified()->create();

// Create multiple users
$users = User::factory()->count(5)->create();
The factory’s default password is 'password' (hashed with Hash::make()). Use this in tests:
$this->actingAs(User::factory()->create())
     ->post('/login', ['email' => $user->email, 'password' => 'password']);

Extending the User model

As Stratus grows to support POS-specific features, extend the User model by adding new attributes and relationships.

Adding POS-specific attributes

Add new columns via a migration, then add them to $fillable:
php artisan make:migration add_role_to_users_table
app/Models/User.php
protected $fillable = [
    'name',
    'email',
    'password',
    'role',        // e.g. 'cashier', 'manager', 'admin'
    'store_id',    // foreign key to a stores table
];

Adding relationships

app/Models/User.php
public function store(): BelongsTo
{
    return $this->belongsTo(Store::class);
}

public function transactions(): HasMany
{
    return $this->hasMany(Transaction::class);
}
Keep the User model focused on identity and authentication. Move POS-specific business logic into dedicated models (e.g., Cashier, Transaction, Store) and relate them back to User.