Make Todo List in Laravel 8 Tutorial

Todo List is software in the category of Task Management, Activity, Productivity, Motivation, and useful for completing goals.

Today, I’m going to show you how to make a simple Todo List app in Laravel 8 step by step. If you are a beginner, start making simple projects is a process for every programmer in order to gain more experience to solve any problem. once you are comfortable with it, move on to advance projects. without further ado, Let’s get started.

Creating a new Laravel Project

composer create-project laravel/laravel todolist

Making Controller, Model, Migration

php artisan make:model Todolist -mcr

Schema::create('todolists', function (Blueprint $table) {
php artisan migrate

Adding Routes


Route::get('/', [TodolistController::class, 'index'])->name('index');
Route::post('/', [TodolistController::class, 'store'])->name('store');
Route::delete('/{todolist:id}', [TodolistController::class, 'destroy'])->name('destroy');

Adding Controller actions


public function index()
    $todolists = Todolist::all();
    return view('home', compact('todolists'));

public function store(Request $request)
    $data = $request->validate([
        'content' => 'required'

    return back();

public function destroy(Todolist $todolist)
    return back();

Blade Template


<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Todo List</title>
    <!-- Font Awesome -->
    <link href="" rel="stylesheet" />
    <!-- MDB -->
    <link href="" rel="stylesheet" />
    <script type="text/javascript" src=""></script>

<body class="bg-info">
    <div class="container w-25 mt-5">
        <div class="card shadow-sm">
            <div class="card-body">
                <h3>To-do List</h3>
                <form action="{{ route('store') }}" method="POST" autocomplete="off">
                    <div class="input-group">
                        <input type="text" name="content" class="form-control" placeholder="Add your new todo">
                        <button type="submit" class="btn btn-dark btn-sm px-4"><i class="fas fa-plus"></i></button>
                {{-- if tasks count --}}
                @if (count($todolists))
                <ul class="list-group list-group-flush mt-3">
                    @foreach ($todolists as $todolist)
                    <li class="list-group-item">
                        <form action="{{ route('destroy', $todolist->id) }}" method="POST">
                            {{ $todolist->content }}
                            <button type="submit" class="btn btn-link btn-sm float-end"><i
                                    class="fas fa-trash"></i></button>
                <p class="text-center mt-3">No Tasks!</p>
            @if (count($todolists))
            <div class="card-footer">
                You have {{ count($todolists) }} pending tasks




Video Tutorial

598 Comments on “Make Todo List in Laravel 8 Tutorial”

  1. Pingback: acyclovir marone

Leave a Reply

Your email address will not be published. Required fields are marked *