Laravel 4: how to run a raw SQL?

前端 未结 7 985
情书的邮戳
情书的邮戳 2020-11-29 01:26

I want to rename a table in Laravel 4, but don\'t know how to do that.

The SQL is alter table photos rename to images. If there is an Eloquent solution,

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 01:44

    You can also use DB::unprepared for ALTER TABLE queries.

    DB::unprepared is meant to be used for queries like CREATE TRIGGER. But essentially it executes raw sql queries directly. (without using PDO prepared statements)

    https://github.com/laravel/framework/pull/54

提交回复
热议问题