Home / Snippets / How to Add Timezones Fields in Laravel Migration
How to Add Timezones Fields in Laravel Migration cover

How to Add Timezones Fields in Laravel Migration

896

3 years ago

0 comments

To add a timezone field in Laravel migration, you can specify the field/column to have timezone by using "timestampsTz()" method. Since the common way is to use "timestamps()" you can replace it to use the timezone method.

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->timestampsTz();
});

Once you have run the migration, now you will be able to specify the timezone for the timestamp.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this