What i make the field into table working with Eloquent?
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('diaries', function (Blueprint $table) {
$table->id();
$table->date("Y-m-d");
......
You can do it without specifying the format, laravel will handle it's format same as you want behind the scenes.
public function up(): void
{
Schema::create('diaries', function (Blueprint $table) {
$table->id();
$table->date('diary_date'); // This will store a date in Y-m-d format
});
}