Skip to main content

Overview

This guide explains all environment variables and configuration options for the Restaurant Management System. All configurations are managed through the .env file.

Getting Started

1

Copy Environment File

Create your environment file from the example:
cp .env.example .env
2

Generate Application Key

Generate a unique encryption key:
php artisan key:generate
3

Configure Required Variables

Update the database and application settings according to your environment.

Application Configuration

Core Application Settings

.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
The Restaurant Management System uses Laravel 10.x with PHP 8.1+
VariableDescriptionValuesDefault
APP_NAMEApplication name displayed in emails and UIStringLaravel
APP_ENVCurrent environmentlocal, production, staginglocal
APP_KEYEncryption key for securing dataBase64 string (auto-generated)Empty
APP_DEBUGEnable debug mode and error detailstrue, falsetrue
APP_URLBase URL of the applicationValid URLhttp://localhost
Production Requirements:
  • Set APP_ENV=production
  • Set APP_DEBUG=false
  • Update APP_URL to your domain
  • Generate a new APP_KEY

Logging Configuration

.env
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
VariableDescriptionValues
LOG_CHANNELPrimary logging channelstack, single, daily, slack
LOG_DEPRECATIONS_CHANNELChannel for deprecation warningsnull, single, daily
LOG_LEVELMinimum log level to recorddebug, info, notice, warning, error, critical, alert, emergency
For production, use LOG_LEVEL=error or LOG_LEVEL=warning to reduce log volume.

Database Configuration

.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=restaurante
DB_USERNAME=root
DB_PASSWORD=
VariableDescriptionDefault
DB_CONNECTIONDatabase drivermysql
DB_HOSTDatabase server hostname127.0.0.1
DB_PORTDatabase server port3306
DB_DATABASEDatabase namerestaurante
DB_USERNAMEDatabase usernameroot
DB_PASSWORDDatabase passwordEmpty

Supported Database Drivers

The application is configured for MySQL, but Laravel supports:
  • MySQL 5.7+
  • PostgreSQL 11+
  • SQLite 3.8.8+
  • SQL Server 2017+
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=restaurante
DB_USERNAME=root
DB_PASSWORD=secret

Driver Configurations

Broadcasting

.env
BROADCAST_DRIVER=log
Controls real-time event broadcasting:
  • log - Logs events (development)
  • pusher - Uses Pusher service
  • redis - Uses Redis pub/sub
  • null - Disables broadcasting

Cache

.env
CACHE_DRIVER=file
Determines cache storage mechanism:
  • file - File-based cache (default)
  • redis - Redis cache (recommended for production)
  • memcached - Memcached
  • database - Database cache
  • array - In-memory (testing only)

Filesystem

.env
FILESYSTEM_DISK=local
Default file storage disk:
  • local - Local storage in storage/app
  • public - Public storage in storage/app/public
  • s3 - Amazon S3 (requires configuration)

Queue

.env
QUEUE_CONNECTION=sync
Queue driver for background jobs:
  • sync - Synchronous (no queue, immediate execution)
  • database - Database-backed queue
  • redis - Redis queue (recommended)
  • sqs - Amazon SQS
  • null - Discard jobs

Session

.env
SESSION_DRIVER=database
SESSION_LIFETIME=120
VariableDescriptionValues
SESSION_DRIVERSession storage mechanismfile, cookie, database, redis, memcached, array
SESSION_LIFETIMESession lifetime in minutesInteger (default: 120)
The application uses database sessions. Ensure the sessions table exists by running migrations.

External Services

Redis Configuration

.env
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Redis is optional but recommended for:
  • Caching in production
  • Queue management
  • Session storage
  • Real-time features

Memcached Configuration

.env
MEMCACHED_HOST=127.0.0.1
Alternative caching backend to Redis.

Mail Configuration

.env
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
VariableDescription
MAIL_MAILERMail transport driver (smtp, sendmail, mailgun, ses, postmark)
MAIL_HOSTSMTP server hostname
MAIL_PORTSMTP server port (25, 465, 587, 1025)
MAIL_USERNAMESMTP authentication username
MAIL_PASSWORDSMTP authentication password
MAIL_ENCRYPTIONEncryption protocol (tls, ssl, null)
MAIL_FROM_ADDRESSDefault sender email address
MAIL_FROM_NAMEDefault sender name
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS Configuration

.env
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
Required for:
  • S3 file storage
  • SES email sending
  • SQS queue management
AWS configuration is optional unless you’re using AWS services.

Pusher Configuration (Broadcasting)

.env
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
Required for real-time features like:
  • Live order updates
  • Real-time reservation notifications
  • Kitchen display updates

Vite Asset Configuration

.env
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
These variables expose configuration to the frontend JavaScript bundle. Only include non-sensitive data.

Environment-Specific Configurations

Local Development

.env
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost

DB_HOST=127.0.0.1
DB_DATABASE=restaurante

CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=database

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025

Production

.env
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com

DB_HOST=production-db-host
DB_DATABASE=restaurante
DB_USERNAME=prod_user
DB_PASSWORD=secure-password

CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls

Package-Specific Configuration

Laravel Jetstream

The application uses Laravel Jetstream for authentication:
  • Team management features
  • Profile management
  • Two-factor authentication support

Spatie Laravel Permission

Role-based access control (RBAC) system:
  • Admin role: Full system access
  • Chef role: Kitchen management
  • Mesero (Waiter) role: Order management
  • User role: Customer access

Livewire

Real-time component framework:
  • Dynamic UI updates
  • No page refreshes
  • Interactive components

Caching Configuration

After changing configuration, clear and rebuild caches:
# Clear all caches
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

# Rebuild caches (production only)
php artisan config:cache
php artisan route:cache
php artisan view:cache
Never run config:cache or route:cache in development. It will ignore .env changes.

Validation and Testing

Verify Configuration

# Check current configuration
php artisan config:show

# Test database connection
php artisan tinker
>>> DB::connection()->getPdo();

# Test mail configuration
php artisan tinker
>>> Mail::raw('Test', function($msg) { $msg->to('test@example.com')->subject('Test'); });

Environment Detection

# Check current environment
php artisan env

# Run commands for specific environment
php artisan migrate --env=production

Security Considerations

Critical Security Settings:
  1. Never commit .env file to version control
  2. Use strong, unique APP_KEY
  3. Rotate database passwords regularly
  4. Use environment-specific credentials
  5. Enable HTTPS in production
  6. Restrict database user permissions
  7. Use strong mail passwords or API keys

Next Steps

Build docs developers (and LLMs) love