Laravel Forms 101

Martin Betz • July 7, 2020

I need to admit, I always have to look up how forms work in Laravel. So consider this blog post a quick overview – and a cheatsheet for myself in several months.

Here is how a simple form with one input field, say a fullname, and server-side validation looks like. I will annotate every line. I use TailwindCSS together with the form plugin to get a decent UI with minimal extra markup.

<!-- Blade, e.g. welcome.blade.php -->
<form action="{{ route('form.submit') }}" method="POST" class="space-y-4">

            <div class="text-red-500">{{ $message }}</div>

            <label for="fullname">Fullname</label>
            <input type="text" name="fullname" value="{{ old('fullname') ?? '' }}" class="form-input">



            <button type="submit">Submit</button>



To get your form working, you need to catch the submission. Here's the code for that with some basic validation:

// routes/web.php

use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;

Route::get('/', function () {
    return view('welcome');

Route::post('/submit', function (Request $request) {
        'fullname' => 'required|alpha|min:3',

    return 'Submission allowed';