DEV Community

loading...

Tip for increment and decrement any column in laravel.

Toqeer Abbas
Front-end Developer | Self-teaching web development/design, using online resources - Js, ReactJS
・1 min read

Hi everyone,
Today i will tell you about a tip to increment and decrement any column in Laravel.

$user::find(1)->increment('likes');
$user::find(1)->decrement('likes');

you can use it anywhere where you want.

Discussion (0)