In my laravel + vue application I am trying to update the name and account_external_id column in mysql database.
Here is the code:
// Set the database name and id project
$db_name = $get_db->mysql_db_name;
$id_project = $get_db->id_project;
// Update linked account
$update_linked_account = DB::connection($db_name)
->table($db_name . '.linked_accounts')
->where('id_linked_account', $id_linked_account)
->where('id_project', $id_project )
->update([
'name' => $account_name,
'account_external_id' => $account_id
]);
// If updated
if( $update_linked_account ) {
return response()->json([
'success' => true,
'message' => 'Account updated successfully.'
], 200);
} else {
return response()->json([
'success' => false,
'message' => 'Could not update the account.'
], 200);
}
When I change the name or account_external_id value then press the update button then I can get the $update_linked_account
as true
.
BUT
When I do not change the name or account_external_id value then press the update button then I can get the $update_linked_account
as false
. why? It should give me true
too, right?