Reputation: 935
Hi so i have a project that is already done but there was a request to add a new column to a specific table i was thinking of a way to add that new column to my table without using migrate or php artisan method to it. i was thinking if it is posible to implement it in the controller. say for example the column name is isOut then values should be false
not null
. thanks for any advice
Upvotes: 0
Views: 940
Reputation: 8699
You can use the Schema Builder inside a controller as well as in migrations.
Just include use Illuminate\Support\Facades\Schema;
Then run this inside a controller function:
Schema::table('table_name', function($table)
{
$table->boolean('isOut')->default(false);
});
Take care only to run the controller function once, for example by creating a special route to this function with a random string.
Upvotes: 1