dsadsadsa's avatar

Laravel migrations - place columm before another column

In Laravel we have an after() function that adds a column after a given column, for example :

$table->string('address_line2')->after('address_line1');

I would like to add a before('column') function that would add a column before a given column. I will be grateful for your help.

0 likes
4 replies
Naveed Ali's avatar

there's a ->first() to put it before everything else. There's no ->before()

dsadsadsa's avatar

I know, but I would like to write my own modifier ->before('column'), so my question is where can I do it ?

MichalOravec's avatar

Just use an another column for that in after() or use first()if has to be column on the first place.

Please or to participate in this conversation.