I am using Laravel Framework 5.5.26 and I am querying my db with the following call:
$symbolsArray = DB::table('exchanges')
->join('markets', 'exchanges.id', '=', 'markets.exchanges_id')
->where('name', $exchangeName)
->get(array(
'symbol',
));
If I var_dump($symbolsArray) I get the following output:
class Illuminate\Support\Collection#619 (1) {
protected $items =>
array(99) {
[0] =>
class stdClass#626 (1) {
public $symbol =>
string(7) "BCN/BTC"
}
[1] =>
class stdClass#621 (1) {
public $symbol =>
string(8) "BELA/BTC"
}
[2] =>
class stdClass#623 (1) {
public $symbol =>
string(7) "BLK/BTC"
}
[3] =>
class stdClass#627 (1) {
public $symbol =>
string(8) "BTCD/BTC"
}
...
}
}
I am trying to get the $symbol like the following:
$symbolsArray[$key]['symbol']
However, I get the following error:
Cannot use object of type stdClass as array
Any suggestions how to access the symbol from the query output?