Skip to content

Task Time Log System (Laravel + Livewire) — Manage user time logs with daily hour limits and backend validation, including PHPUnit test cases for validation.

License

Notifications You must be signed in to change notification settings

shalender8928/task-tracking

Repository files navigation

Task Time Log System (Laravel + Livewire)

Overview

This project is a Laravel-based task implementation to manage time logs for users. It includes features to:

  • Add a time log.
  • Restrict users from logging more than 10 hours per day.
  • Proper test cases to validate functionality.
  • Leave application with validation against existing logs
  • Editable task entries, grouped by date

This README will guide you on how to set up the project, run the application, and execute test cases for validation.


Screenshots

Dashboard Screen Dashboard Screen

Time Log Detail - Main Screen Time Log Detail - Main Screen

Leave Detail - Main Screen Leave Detail - Main Screen

Test cases Response Test cases Response

Dark Theme Support Dark Theme Support


Requirements

  • PHP >= 8.1
  • Composer >= 2.x
  • MySQL >= 8.x
  • Laravel >= 10.x
  • Node.js & NPM (for frontend assets, if applicable)

🛠️ Stack

  • Laravel 12.x
  • Livewire 3.x
  • Tailwind
  • MySQL

Installation & Setup

  1. Clone the Repository
    git clone https://github.com/shalender8928/task-tracking.git
    cd task-tracking
  2. Install PHP Dependencies
    composer install
  3. Environment Configuration
    cp .env.example .env
    php artisan key:generate
  4. Run Migrations
    php artisan migrate
  5. Run Seeders (if applicable)
    php artisan db:seed
  6. Serve the Application
    php artisan serve

✅ Features

  • Time log entry with hours & minutes
  • Prevent future dates & total over 10 hrs
  • Leave form blocks date overlap with work logs
  • View task list grouped by date

Running Test Cases

Test cases have been written using Laravel’s built-in PestPHP / PHPUnit testing framework. To execute the tests, follow these steps:

Run All Tests:

Create the .env.testing file first and than don't forgot to setup these lins in your .env.testing file before executing the following command to make your actual data will not affected.

DB_CONNECTION DB_DATABASE

Always keep this --env=testing at the end of the Test command to execute test on the test database only.

DB_CONNECTION=sqlite
DB_DATABASE=:memory:

These setting will ensure that the test will run on sqlite database, you can also switch the database with anyother database that you want to use for testing only.

Now, execute the following command to run the test cases.

php artisan test --env=testing

Run Specific Test File (Recommended for Task Review):

php artisan test --filter=TimeTrackerTest --env=testing

This will run only the tests inside tests/Feature/TimeTrackerTest.php.

Test Cases Covered:

  1. User can add a time log
  • Validates that a user can successfully add a time log entry.
  • User cannot log more than 10 hours per day
  • Ensures that a user is restricted from logging more than 10 hours of time entries for a single day.
  • The test will assert a validation failure with appropriate error messages.

Additional Notes

  • No UI/frontend changes are required for this task.
  • All validations are handled via backend logic.
  • You can adjust the test data inside TimeTrackerTest.php if needed for further scenarios.

Author

Shalender Kumar

Links

License

task-tracking is open-sourced software licensed under the MIT license.

About

Task Time Log System (Laravel + Livewire) — Manage user time logs with daily hour limits and backend validation, including PHPUnit test cases for validation.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages