Here we will discuss morphs migration for creating morph relationship table column. laravel migration tutorials.
Laravel morphs migration
When we use laravel morph relationship, it required a table that contains one or more table relational data. This table has two columns one is biginteger which stores foreign key data and the other is varchar which has a related model path.
Now our morphs() migration method create these two column by one migration.
public function up() { Schema::create('images', function (Blueprint $table) { $table->morphs('imageable'); }); }
Read Also : Laravel union of two queries
In above example morphs('imageable') method create two columns imageable_id(bigint) and imageable_type(varchar).