Laravel Update a Record Without Updating Timestamp Example
This article will provide some of the most important example laravel update record without update timestamp. I’m going to show you about how to update a record without updating timestamp in laravel. you will learn update without update timestamp in laravel. you can see laravel update query without update timestamp.
You can use these tips with laravel 6, laravel 7, laravel 8 and laravel 9 versions.
Sometimes, we want to update records on the database table but don't want to update timestamps(updated_at column). Then how you can do it will laravel, we can make $model->timestamps = false; to stop updating timestamps. so let's see the simple code:
class DemoController extends Controller
* Write code on Method
* @return response()
public function index(Request $request)
$post = Post::first();
/* Prevents timestamps auto-update */
$post->timestamps = false;
$post->title = "Demo Updated";
I hope it can help you...
We are Recommending you
- How to Select Specific Columns in Laravel Eloquent Model?
- How to Get All Models in Laravel?
- How to Get Columns Names from Model in Laravel?
- How to Create Model in Laravel using Command?
- Laravel 9 Enum Model Attribute Casting Example
- Laravel 9 Model Events Example Tutorial
- Laravel Eloquent Model Custom Function Example
- How to Create Custom Model Events in Laravel?
- Laravel Replicate Model with Relationships Example
- How to use Laravel Model Observers?
- Laravel - How to disable created_at and updated_at timestamps from Model?
- How to disable model timestamps in Laravel?