This is more one post on mysql query, I don't remember exactly time but i had need to change name of foreign key constraint column field. We can rename field name easily if we didn't set foreign key constraint. But if you set foreign key constraint then you can't rename easily. I had rename directly from my phpmyadmin without mysql query but i found bellow error:
#1025 - Error on rename of './learn/#sql-46c_246' to './learn/my_table' (errno: 150)
But i found the solution of mysql rename foreign key constraint using mysql query, First we have to drop the foreign key,.....
Sometimes, we require to run directly mysql query on Laravel for example if you need to copy one table to other table using mysql query. I also need in one project and that's why i am fetching problem. But you can use sql query on laravel using db statement in bellow example you can learn how to run.
<pre class="prettyprint lang-php">
INSERT INTO `posts` (repost_of_id,token_id,post_details,user)
FROM `posts` where id = ".$postId."