I have a model called Log
. It has a foreign key called hash_id
, and a belongsTo
relationship to App\Hash
.
I understand that I can retrieve the corresponding hash entry by calling Log::with('hash')
as mentioned here. What I'd like to do is retrieve specific rows of the corresponding hash column instead of every one of them. So something like Log::with('hash', ['only' => 'name'])
. This is because I'm sending the data over AJAX, and don't want to send a lot of unnecessary columns with it. How can I do this?