
Posted on • Originally published atmeshworld.in
Ways to declare unsigned columns in the Laravel migrations
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 ofunsigned
type.
In this tutorial, we'll see how we can declare columns as unsigned in different ways in Laravel.
You need to importIlluminate\Database\Schema
namespace withuse
keyword.
UsingunsignedInteger
column types
$table->unsignedInteger('user_id');
Using onlyinteger
column type
$table->integer('user_id',false,true);
Usinginteger
column type withunsigned
column modifier
$table->integer('user_id')->unsigned();
Read the complete post on our siteMeshWorld -Ways to declare unsigned columns in the Laravel migrations
For more, you can check the official documentation for migrationscreating-columns page.
Read others post on our siteMeshWorld
Happy coding
With ❤️ from 🇮🇳
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse