Solution:
I tried it with following code and it worked.
$primarykey = DB::select('SHOW KEYS FROM users WHERE Key_name = "PRIMARY"');
I had used select of DB without get method because it returns array like this
[
{#3558
+"Table": "users",
+"Non_unique": 0,
+"Key_name": "PRIMARY",
+"Seq_in_index": 1,
+"Column_name": "id",
+"Collation": "A",
+"Cardinality": 1,
+"Sub_part": null,
+"Packed": null,
+"Null": "",
+"Index_type": "BTREE",
+"Comment": "",
+"Index_comment": "",
},
]
So please try and let me know if you find any issue in it. Thanks