NEW in Laravel 9.48: incrementEach() To Update Multiple Columns

preview_player
Показать описание
Another new feature in a minor Laravel version makes our database work more convenient.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

that's super handy. wont use it that often but can picture some use-cases for it

itsmillrtime
Автор

Now I know there is a special increment method 😅
Thanks

ismoil
Автор

Nice trick 👌
I have a question if I use
DB::beginTransaction()
Try{
$product->update()
}catch(){
DB::rollback()
}
DB::commit()

Does the eloquent script execute as the transaction body or not ?

ahmedbenrhouma
Автор

why do you store "total" when you also store "in_store" and "in_stock"? It's simply redundant and doesn't follow the third normal form. you can make an accessor for total.

mmahdi