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.
- PHP >= 8.1
- Composer >= 2.x
- MySQL >= 8.x
- Laravel >= 10.x
- Node.js & NPM (for frontend assets, if applicable)
- Laravel 12.x
- Livewire 3.x
- Tailwind
- MySQL
- Clone the Repository
git clone https://github.com/shalender8928/task-tracking.git cd task-tracking - Install PHP Dependencies
composer install
- Environment Configuration
cp .env.example .env php artisan key:generate
- Run Migrations
php artisan migrate
- Run Seeders (if applicable)
php artisan db:seed
- Serve the Application
php artisan serve
- 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
Test cases have been written using Laravel’s built-in PestPHP / PHPUnit testing framework. To execute the tests, follow these steps:
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=testingphp artisan test --filter=TimeTrackerTest --env=testingThis will run only the tests inside tests/Feature/TimeTrackerTest.php.
- 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.
- 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.
Shalender Kumar
- Blog:https://www.codinghelpsolutions.com/
- GitHub:https://github.com/shalender8928
- LinkedIn:https://www.linkedin.com/in/shalender8928/
task-tracking is open-sourced software licensed under the MIT license.