I prefer #1, but simply go with #2 😆
Seriously, constrains keep your data consistent, you shouldn't neglect them.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When creating schemas and foreign keys, do you prefer the following:
$table->foreignId('category_id')->nullable()->constrained('categories')->onDelete('cascade');
Or do you simply go with:
$table->unsignedBigInteger('category_id')->index();
And then manually handle it through models?
Please or to participate in this conversation.