I get the following error when i try this error: Call to undefined method Illuminate\Database\Eloquent\Collection::select() Running this:
Portfolio::find($id)->transactions
->select('id','date','symbol','transaction_type','qty','amount');
but this works.
Portfolio::find($id)->transactions
I have a relationship in my portfolio model for
$this->hasMany('Transaction','portfolio_id');
So now to the real question. How can i select certain fields from the transactions table using eager loading? or do i need to do it using query builder