Solved, it was the fetch config @config/database.php, it had to be set to PDO::FETCH_CLASS
Jun 4, 2021
1
Level 13
Duplicated properties on every retrieved model
This is a weird one, every model retrieved from the database has its keyed properties, but also a duplicated property keyed by a numeric index.
Tinker output below:
` use App\V1\Models\User;
$user = User::find(11);
App\V1\Models\User {#3129
id: 11,
0: 11,
first_name: "test",
1: "test",
last_name: "tester",
2: "tester",
username: "testo",
3: "testo",
email: "[email protected]",
4: "[email protected]",`
Recent changes to the application arquitecture included the separation of the users table into a dedicated database of its own, for this purpose another connection was added to config/database.php and set on the User model.
But the duplicated properties thing happens to every model.
Please or to participate in this conversation.