Sunday, March 4, 2018

Laravel Query builder insert 1 value higher than last record - development

Laravel Query builder insert 1 value higher than last record

I have a problem with laravel query builder. I have a query, which contains one value INT. It should be always 1 higher than last record in database. And I don’t know how to do it in Laravel Query builder. In raw SQL I would do

INSERT INTO table_name (name, order)
VALUES ('ahoy', order + 1);

And it should work. But I have really no idea how to do it in laravel query builder



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-query-builder-insert-1-value-higher-than-last-record/
via Lzo Media

No comments:

Post a Comment