Q:

Laravel 5.2 Query Builder get as a single array(not 2D or 3D)

This is my query. 
$mem = DB::table('user_zakathorg')
       ->JOIN('zakathorgs', 'user_zakathorg.zakathorg_id', '=', 'zakathorgs.ID')
       ->WHERE('user_id', '=', Auth::user()->id )
       ->SELECT('zakathorg_id', 'orgName')->get();

And the output is always one raw. like following image

If i want to accesss the zakathorg_id. I have to use a foreach loop. And I can't access   
$mem[0]['zakathorg_id] 
how can i use this as simply $mem['zakathorg_id'] 

A:

Use first() method instead of get():
$mem = DB::table('user_zakathorg')
       ->JOIN('zakathorgs', 'user_zakathorg.zakathorg_id', '=', 'zakathorgs.ID')
       ->WHERE('user_id', '=', Auth::user()->id )
       ->SELECT('zakathorg_id', 'orgName')->get();
// You can access $mem->zakathorg_id now

