This is a simple To-Do List application built with Laravel using the MVC structure. It allows users to create, read, update, and delete tasks. The application also implements request validation and follows best practices for structuring a Laravel project.
-
Create new tasks
-
View all tasks
-
Mark tasks as completed
-
Edit existing tasks
-
Delete tasks
-
Request validation using Form Requests
-
Clean MVC structure
To create a new task, click the "Add Task" button and fill in the task title. The task will be added to the list of tasks.
The main page displays a list of all tasks. Completed tasks are shown with a strikethrough.
You can edit any task by clicking on its title. You will be redirected to an edit form where you can change the task details.
Tasks can be marked as completed by clicking on their title, which applies the line-through
class.
You can delete any task by clicking the delete button next to it.
The application uses Laravel's Form Request Validation to validate input data when creating and updating tasks. Validation rules are defined in a custom request file (TaskRequest
), ensuring that task titles are required and follow specific constraints.
public function rules()
{
return [
#There is a rule that the title is required and must be a string with a maximum length of 255 characters.
];
}
This project follows the Model-View-Controller (MVC) pattern.
-
Models: The
Task
model is responsible for interacting with the database. -
Views: Blade templates are used to display the list of tasks and forms.
-
Controllers:
TaskController
handles business logic and user interactions.
Routes are defined in the web.php
file. Example:
Route::resource('tasks', TaskController::class);
This uses Laravel's resource routes, automatically creating routes for CRUD operations.
You can write tests for your application using Laravel's testing capabilities. Run the following command to execute tests:
php artisan test
Feel free to contribute to this project by submitting issues or pull requests. All contributions are welcome!
This project is open-source and licensed under the MIT License.
This README.md
provides a comprehensive overview of your Laravel To-Do List application and covers installation, usage, and the structure of the project. Let me know if you'd like to modify anything!