I have a relationship inside my laravel model
/**
* Relation with calculations table
*
* @return object
*/
public function calculations()
{
return $this->hasMany('App\Calculation');
}
When i am selecting data with relation as
$this->diamonds
->select('id', 'image', 'number', 'weight', 'diamond_date', 'price')
->with('calculations')->first();
It returns all data and works fine, but when i want to select specific column it returns [] blank array
$this->diamonds
->select('id', 'image', 'number', 'weight', 'diamond_date', 'price')
->with(['calculations', function($query){
$query->select('id', 'height', 'width')
}])->first();
I search lot and every one suggest to select data with this type but i don't know why data is empty while i am selecting specific column.