/laravel_task

TDH

Primary LanguagePHPMIT LicenseMIT

Laravel Product Management System

A project for jazmin.b@tdh.tech company.

This is a full-featured web application built with Laravel that provides a comprehensive system for managing users and products. It includes a complete authentication system, user profile management, an admin panel with full CRUD functionality for users, and product management capabilities with image uploads.

Task Requirements

The application was built to fulfill the following requirements:

  1. Registration:
    • With Email:
      • First Name
      • Last Name
      • Email
      • Password
    • With Phone Number:
      • First Name
      • Last Name
      • Phone Number
      • Password
  2. Login:
    • Login with either email or phone number.
  3. Profile Management:
    • View user information in profile page.
    • Update user information.
    • Change password.
  4. Product Management:
    • Add a product (Name, Image, Description).
    • Edit product information.
    • Delete a product.
    • View all products with pagination.
  5. Admin Capabilities:
    • Assign products to specific users.
    • View all products created by a specific user, with pagination.

Features

  • User Authentication:

    • Secure user registration and login.
    • Users can register and log in using either an email address or a phone number.
    • Password hashing using Bcrypt.
    • Session management and "remember me" functionality.
  • Profile Management:

    • Users can view and update their profile information (name, email, phone).
    • Users can change their password.
  • Product Management (User):

    • Authenticated users can create, read, update, and delete their own products.
    • Support for product image uploads, with files stored locally.
    • A paginated list of a user's products on their dashboard.
  • Public Product Listings:

    • A public-facing page that displays all products from all users, with pagination.
    • Each product card shows the product name, description, price, and the name of the user who uploaded it.
  • Admin Panel:

    • Full User CRUD: Administrators can create, read, update, and delete any user in the system.
    • Role Management: Admins can assign 'user' or 'admin' roles.
    • Advanced User Deletion: When deleting a user who has products, the admin is prompted with a modal to either:
      1. Delete all of the user's products permanently.
      2. Reassign all of the user's products to their own admin account.
    • Product Assignment: Admins can assign a product to any user when creating or editing it.
  • Frontend:

    • Built with Blade templates and styled with Tailwind CSS loaded via a CDN.
    • Responsive design that works on desktop and mobile.
    • Interactive UI elements powered by Alpine.js for modals and dropdowns.
  • Frontend:

    • Built with Blade templates for the view layer.
    • Tailwind CSS: Styled using the Tailwind CSS framework, loaded via CDN for rapid development.
      • https://cdn.tailwindcss.com?plugins=forms
    • Alpine.js: Used for interactive UI components like modals and dropdowns, loaded via CDN.
      • https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js

Technology Stack

  • Backend: PHP 8.2, Laravel 12.x
  • Frontend: Blade Templates, Tailwind CSS, Alpine.js
  • Database: MySQL (or any other Laravel-supported database)

Installation and Setup

Follow these steps to get the project up and running on your local machine.

  1. Clone the Repository

    git clone <repository-url>
    cd laravel_task
  2. Install Dependencies Install the PHP dependencies using Composer.

    composer install
  3. Environment Configuration

    • Copy the .env.example file to a new file named .env.
      cp .env.example .env
    • Generate a new application key.
      php artisan key:generate
    • Configure your database connection details in the .env file (DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD).
  4. Run Database Migrations and Seeders This will create all the necessary tables and seed the database with a default admin user.

    php artisan migrate --seed
  5. Create Storage Link This makes the public/storage directory accessible for viewing uploaded product images.

    php artisan storage:link
  6. Serve the Application Start the local development server.

    php artisan serve

    The application will be available at http://127.0.0.1:8000.

Admin Credentials

After running the migrations and seeders, a default admin account will be created with the following credentials:

  • Email: admin@example.com
  • Password: password

You can use these credentials to log in and access the admin panel.

Laravel Logo

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.

Premium Partners

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.