Apr 15, 2022
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.
Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip following step.
composer create-project laravel/laravel example-app
// update record in first database
// update record in different database
$userModel = new User();
$userData = $userModel->setConnection('mysql_default')
->update(['name' => 'john']);
I hope it will help you...