How to check column exists or not in table Laravel 5

By Hardik Savani | May 4, 2016 | | 1161 Viewer | Category : Laravel

Share this post:

When i was working my laravel application at that time i need to remove column from database. But i am not sure that column is exists or not in tables. So i was thinking, but i found solution from Laravel Database Migration Schema. we can check column is exists or not in tabales using hasColumn. If you also need to remove if column is exists then you can use bellow example.


if (Schema::hasColumn('subscriptions', 'stripe_id')) {

Schema::table('subscriptions', function ($table) {