Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Ways to declare unsigned columns in the Laravel migrations
Vishnu Damwala
Vishnu Damwala

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)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

A human being currently living in India🇮🇳 on Earth.Founder of MeshWorld, a web geek, an industry experienced web developer & tutor/instructor currently lives in Surat City.
  • Location
    Surat, India
  • Joined

More fromVishnu Damwala

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp