Skip to content

πŸ“¦ Modern Laravel 12 Inventory Management System with Jetstream authentication, role-based permissions, audit logging, file attachments, and Excel import/export. Developed as a Pifacia coding test study case using PHP 8.2+, Tailwind CSS, and Livewire.

License

Notifications You must be signed in to change notification settings

zoelabbb/ct-pifacia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CT-Pifacia - Inventory Management System

Laravel Version PHP Version License PRs Welcome Coding Test Study Case

Dashboard Screenshot

πŸ“‹ About CT-Pifacia

CT-Pifacia is a Coding Test project from Pifacia that I took as a study case to demonstrate modern web development skills. This comprehensive Inventory Management System is built with Laravel 12 and cutting-edge web technologies, showcasing best practices in PHP development, database design, and modern frontend implementation.

🎯 Project Purpose

This project serves as a practical demonstration of:

  • Modern Laravel Development: Utilizing Laravel 12 with latest PHP 8.2+ features
  • Full-Stack Development Skills: From backend API to responsive frontend
  • Enterprise-Level Architecture: Implementing patterns suitable for production applications
  • Code Quality Standards: Following PSR-12, testing with Pest PHP, and comprehensive documentation
  • Security Best Practices: Role-based permissions, audit logging, and secure authentication

The application provides a robust solution for managing items, categories, and users with advanced features like role-based permissions, audit logging, file attachments, and data import/export capabilities.

🎯 Key Features

  • πŸ“¦ Item Management: Complete CRUD operations for inventory items
  • 🏷️ Category Management: Organize items with hierarchical categories
  • πŸ‘₯ User Management: Comprehensive user administration with role-based access
  • πŸ” Authentication & Authorization: Laravel Jetstream with role-based permissions
  • πŸ“Š Audit Logging: Track all changes and user activities
  • πŸ“€ Import/Export: Excel-based data import and export functionality
  • πŸ—‚οΈ File Attachments: Media library integration for item attachments
  • πŸ—‘οΈ Soft Delete: Safe deletion with restore capabilities
  • πŸ“± Responsive Design: Modern UI with Tailwind CSS and Livewire
  • ⚑ Real-time Updates: Live interface updates with Livewire

πŸŽ“ Coding Test & Study Case

This project was originally developed as a coding test from Pifacia and has been taken as a comprehensive study case to demonstrate:

πŸ” Technical Challenges Addressed

  • Complex Database Relationships: UUID-based models with proper foreign key constraints
  • Advanced Authentication: Multi-role system with granular permissions
  • File Management: Secure file uploads with media library integration
  • Data Processing: Excel import/export with validation and error handling
  • Performance Optimization: Efficient queries, caching, and queue processing
  • Testing Strategy: Comprehensive test suite using modern Pest PHP framework

πŸ“š Learning Outcomes

  • Laravel 12 Mastery: Latest framework features and best practices
  • Modern PHP Development: PHP 8.2+ features, typing, and standards
  • Frontend Integration: Livewire for reactive interfaces without complex JavaScript
  • Security Implementation: Authentication, authorization, and data protection
  • DevOps Practices: Development workflows, testing, and deployment strategies

πŸ† Skills Demonstrated

  • Full-stack web development
  • Database design and optimization
  • API development and documentation
  • Modern UI/UX implementation
  • Code quality and testing
  • Technical documentation
  • Git workflow and version control

πŸš€ Tech Stack

Backend

  • Laravel 12.x - Modern PHP framework
  • PHP 8.2+ - Latest PHP features
  • SQLite/MySQL - Database support
  • Laravel Jetstream - Authentication scaffolding
  • Laravel Sanctum - API authentication
  • Livewire 3.x - Dynamic frontend components

Frontend

  • Tailwind CSS 3.x - Utility-first CSS framework
  • Blade Components - Reusable UI components
  • Heroicons - Beautiful SVG icons
  • Vite - Fast build tool and dev server

Additional Features

  • Spatie Laravel Permission - Role and permission management
  • Laravel Auditing - Model change tracking
  • Spatie Media Library - File upload and management
  • Maatwebsite Excel - Import/export functionality
  • Laravel Horizon - Queue monitoring (dev)
  • Pest PHP - Modern testing framework

πŸ“‹ Requirements

  • PHP: 8.2 or higher
  • Composer: Latest version
  • Node.js: 18.x or higher
  • NPM: Latest version
  • Database: SQLite (included) or MySQL/PostgreSQL

πŸ› οΈ Installation

1. Clone the Repository

git clone https://github.com/zoelabbb/ct-pifacia.git
cd ct-pifacia

2. Install PHP Dependencies

composer install

3. Install Node.js Dependencies

npm install

4. Environment Configuration

# Copy environment file
cp .env.example .env

# Generate application key
php artisan key:generate

5. Database Setup

# Create SQLite database (default)
touch database/database.sqlite

# Run migrations with seeders
php artisan migrate --seed

6. Storage Link

php artisan storage:link

7. Build Assets

# Development
npm run dev

# Production
npm run build

πŸƒβ€β™‚οΈ Running the Application

Development Mode

# Option 1: Use the built-in development command (recommended)
composer run dev

# Option 2: Manual setup
# Terminal 1: Start Laravel server
php artisan serve

# Terminal 2: Start queue worker
php artisan queue:listen

# Terminal 3: Start Vite dev server
npm run dev

# Terminal 4: Monitor logs (optional)
php artisan pail --timeout=0

Production Mode

# Build assets for production
npm run build

# Configure web server (Nginx/Apache) to point to public/ directory

πŸš€ Demo Access

After setting up the application, you can access it using these pre-configured demo accounts:

πŸ‘‘ Administrator Account

Email: [email protected]
Password: admintest
Access Level: Full system access

Features Available:

  • βœ… Full item management (CRUD)
  • βœ… Category management
  • βœ… User management & roles
  • βœ… Audit logs access
  • βœ… Import/Export functionality
  • βœ… System administration

πŸ‘€ Staff Account

Email: [email protected]
Password: stafftest
Access Level: Limited access

Features Available:

  • βœ… View items and categories
  • ❌ Limited administrative functions
  • ❌ No user management access

πŸ”— Quick Demo Access

  1. Start the application: composer run dev or php artisan serve
  2. Open browser: Navigate to http://localhost:8000
  3. Login: Use any of the demo accounts above
  4. Explore: Try different features based on your role

πŸ’‘ Pro Tip: The login page includes quick-fill buttons for easy demo access!

πŸ“š Features Documentation

πŸ” Authentication & Authorization

The application uses Laravel Jetstream with Spatie Laravel Permission for comprehensive authentication and authorization:

Default Roles:

  • Administrator: Full system access
  • Manager: Limited administrative access
  • User: Basic item viewing access

Permissions:

  • Categories: view, create, edit, delete
  • Items: view, create, edit, delete
  • Users: view, create, edit, delete (Admin only)
  • Roles: view, create, edit, delete (Admin only)

πŸ“¦ Item Management

Features:

  • CRUD Operations: Create, read, update, delete items
  • Category Assignment: Link items to categories
  • File Attachments: Upload and manage item images/documents
  • Soft Delete: Items can be safely deleted and restored
  • Bulk Operations: Import/export via Excel files
  • Price Management: Decimal precision pricing
  • Status Control: Active/inactive item states
  • Metadata: JSON-based additional item information
  • Publishing: Schedule item publication dates

Item Properties:

  • UUID-based identification
  • Name and description
  • Category relationship
  • Price (decimal with 2 places)
  • Active status (boolean)
  • Metadata (JSON)
  • Publication date
  • File attachments
  • Audit trail

🏷️ Category Management

Features:

  • Hierarchical Structure: Parent-child category relationships
  • CRUD Operations: Full category management
  • Status Control: Active/inactive categories
  • Item Relationships: Track items per category

πŸ‘₯ User Management (Admin Only)

Features:

  • User CRUD: Complete user administration
  • Role Assignment: Assign roles to users
  • Profile Management: User profile information
  • Account Status: Enable/disable accounts

πŸ“Š Audit Logging

Track all model changes with detailed audit logs:

  • User Actions: Who made changes
  • Timestamps: When changes occurred
  • Change Details: What was modified
  • IP Tracking: Source of changes

πŸ“€ Import/Export

Excel Import:

  • Bulk Item Creation: Import items from Excel files
  • Validation: Data validation during import
  • Error Reporting: Detailed import results

Excel Export:

  • Filtered Exports: Export with filters
  • Formatted Data: Professional Excel formatting
  • Scheduled Exports: Automated export generation

πŸ—„οΈ Database Schema

Items Table

- id (UUID, Primary Key)
- category_id (UUID, Foreign Key)
- name (String)
- description (Text, Nullable)
- price (Decimal 10,2)
- is_active (Boolean, Default: true)
- meta (JSON, Nullable)
- published_at (Timestamp, Nullable)
- attachments (JSON, Nullable)
- deleted_at (Timestamp, Nullable) -- Soft Delete
- created_at, updated_at (Timestamps)

Categories Table

- id (UUID, Primary Key)
- name (String, Unique)
- description (Text, Nullable)
- is_active (Boolean, Default: true)
- published_at (Timestamp, Nullable)
- created_at, updated_at (Timestamps)

πŸš€ Deployment

Production Checklist

  1. Environment Configuration:

    # Set production environment
    APP_ENV=production
    APP_DEBUG=false
    
    # Configure database
    DB_CONNECTION=mysql
    DB_HOST=your-host
    DB_DATABASE=your-database
    DB_USERNAME=your-username
    DB_PASSWORD=your-password
  2. Build and Optimize:

    # Install production dependencies
    composer install --optimize-autoloader --no-dev
    
    # Build assets
    npm run build
    
    # Optimize Laravel
    php artisan config:cache
    php artisan route:cache
    php artisan view:cache
  3. Run Migrations:

    php artisan migrate --force
  4. Web Server Configuration:

    • Point document root to public/ directory
    • Configure URL rewriting for Laravel
    • Set appropriate file permissions

πŸ”§ Configuration

Key Configuration Files

  • .env: Environment variables
  • config/app.php: Application settings
  • config/database.php: Database configuration
  • config/permission.php: Role/permission settings
  • config/audit.php: Audit logging configuration

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the Repository
  2. Create a Feature Branch: git checkout -b feature/amazing-feature
  3. Commit Changes: git commit -m 'Add amazing feature'
  4. Push to Branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow PSR-12 coding standards
  • Write tests for new features
  • Update documentation as needed
  • Follow semantic versioning for releases

πŸ“„ License

This project is open-sourced software licensed under the MIT License.

πŸ‘¨β€πŸ’» Author

Zoelabbb

πŸ“ About This Project

This repository contains a coding test originally from Pifacia that I completed and expanded upon as a comprehensive study case. The project demonstrates modern Laravel development practices and serves as a portfolio piece showcasing full-stack development capabilities.

Note: This is a study case implementation based on a coding test scenario. The project has been enhanced with additional features, comprehensive documentation, and best practices to serve as a learning resource and portfolio demonstration.


Built with ❀️ using Laravel 12 & Modern Web Technologies
A Coding Test Study Case from Pifacia

About

πŸ“¦ Modern Laravel 12 Inventory Management System with Jetstream authentication, role-based permissions, audit logging, file attachments, and Excel import/export. Developed as a Pifacia coding test study case using PHP 8.2+, Tailwind CSS, and Livewire.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages