Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

atif123's avatar

Date is not showing in laravel

I am getting data from form and saving to database but user entered date is not storing

            blade
                            <div class = "form-group mt-3">
                                <label for = "date"><h5>When</h5></label><br>
                                <input type = "date" id = "date" name = "date">
                            </div>

            database
            $table->date('when');
0 likes
3 replies
Nakov's avatar
Nakov
Best Answer
Level 73

Based on your code I don't see you using the correct syntax: {{ $table->date('when'); }} ? And add that in the value attribute of your input:

<input type="date" id="date" name="date" value="{{ $table->date('when'); }}">
1 like
atif123's avatar

didn't worked Undefined variable: table (View: /opt/lampp/htdocs/COLLEGEPROJECT/todolist/resources/views/layouts/app.blade.php)

app.blade.php input type="date" id="date" name="date" value="{{ $table->date('when') }}"

controller store $event->when=$request['date'];

database $table->date('when');

Nakov's avatar

@atif123 please read on how to pass data to the view in the docs or on the internet, plenty of tutorials out there, I would've helped more if I can read your code, but unfortunately I cannot.

Please or to participate in this conversation.