I want a single row of player through his playerNo field which is later added and updated.
I am doing this.
$player = Account::where('playerNo', 99)->get();
Result is many objects of players that only has player object with playerNo, which I do not want because for that I have to use iteration.
foreach($players as $player)
$player->name = "Samar"
Another option is to use firstWhere
$player = Account::where('playerNo', 99)->first();
is the same as
$player = Account::firstWhere('playerNo', 99);