Support the ongoing development of Laravel.io →
Requests Database
Last updated 1 year ago.
0

I think you can start with -

  1. Passing in all the parameters you need to create a column. (table name, new column name, data type etc).
  2. Pick up the parameters, generate your sql queries (You can choose to use DB::raw to run ur queries but watch out for possible SQL Injection. You can also play with the methods in https://laravel.com/api/5.2/Illuminate/Database/Schema/Bluepri...)
0

hah, okay - I found another easy way ^^

You can use this code in your controller:

        Schema::table('user_option_values', function ($table) {
            $optionName = Input::get('myInput');
            $table->string($optionName);
        });

Input::get is globally available instead of my solution ^^ But thanks for your help, @ndy40 :)

0

saving post

0

Sign in to participate in this thread!

Eventy

Your banner here too?

me4tshield me4tshield Joined 13 Sep 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.