Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel migration check if table has column

// You may check for the existence of a table or column
// using the hasTable and hasColumn methods:

if (Schema::hasTable('users')) {
    // The "users" table exists...
}

if (Schema::hasColumn('users', 'email')) {
    // The "users" table exists and has an "email" column...
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #migration #check #table #column
ADD COMMENT
Topic
Name
3+9 =