i'm so sorry if this question already asked before,
so what i'm trying to do is to get result like this from my models
$data = $userModel->where('username', 'myname')->find();
my expectation :
$data = [
'id' => 1,
'username' => 'myname',
'fullname' => 'my full name',
]
what i get :
$data = [
0 => [
'id' => 1,
'username' => 'myname',
'fullname' => 'my full name',
]
]
from the docs here, it does return a single row as result, but when i want to use the value of the array, i need to type it like this :
$data[0]['username']
instead of like this :
$data['username']
it does work as intended when i do it like this without the 'where' condition :
$data = $userModel->find(1);
but the problem arise when i want to search using the 'username' value instead. then i tried it like this and of course it doesn't work (return null) :
$data = $userModel->find('username', 'myname');
any pointer would be much apreciated, thank you.