Laravel 8 How To Update Diffrent Database Record
Hi Guys,
In this article we will discuss about Laravel how to update record in diffrent MySQL database using laravel framework PHP. Sometimes we need multiple databases in our system to work with and laravel is capable of doing this.
You update some records on different database so make this code and update the record.
With no more complexity, in this article is pretty easy to implement you will find the exact changes you want to make in your system.
Let’s start implementing dynamic database connection tutorial laravel.
Please follow steps to integrate the laravel database connection.
Solution :
// update record in first database
User::update($input);
// update record in different database
$userModel = new User();
$userData = $userModel->setConnection('mysql_default')
->where('id', 5)
->update(['name' => 'john']);
I hope it will help you...
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial