laravel foreign and primary key mysql code example Example: laravel migration with primary key $table->string('code', 30)->primary();