I don't know if it's possible but basically what I want is when i save() an object and a column is not found, it should be automatically added to the table.
For example:
$information = new App\Information;
$meta = new App\Meta;
//Insert real info for $information
$information->save();
$meta->description = "random description" //This is an existing column
$meta->newColumn = "Random string" //This column doesn't exist
$information->meta()->save($meta);
So what I want it do is create the column "newColumn" in the table Meta because it doesn't exist.
Is there a way of doing this without creating a new migration?
EDIT: I have found a method which I think is the best one to do it, I guess..
if (!Schema::hasColumn('meta', 'newColumn')){
Schema::Table('meta',function($table){
$table->string('newColumn');
});
}
If someone has a better solution. Feel free to add
FINAL EDIT:
Thanks everyone for your input and help but we have designed a new database table that allows us to dynamically add new data as we please. Still thanks for all of your efforts :)