Laravel developers love the way it handles relationships between tables by just associating models with each other.
The column which defines the relationship between tables must be of unsigned
type.
In this tutorial, we'll see how we can declare columns as unsigned in different ways in Laravel.
You need to import Illuminate\Database\Schema
namespace with use
keyword.
Using unsignedInteger
column types
$table->unsignedInteger('user_id');
Using only integer
column type
$table->integer('user_id', false, true);
Using integer
column type with unsigned
column modifier
$table->integer('user_id')->unsigned();
Read the complete post on our site MeshWorld - Ways to declare unsigned columns in the Laravel migrations
For more, you can check the official documentation for migrations creating-columns page.
Read others post on our site MeshWorld
Happy coding
With ❤️ from 🇮🇳
Top comments (0)