I'm returing a model with all the related models. My problem is that perhaps some models don't have records so they are returned in my $property
variable as empty and I have to evaluate their existence in blade (not done yet) Is there any way in controller or parent model to return only the child relationships which have records? Or any blade directive to evaluate these cases? All relationships are 1:M.
Regards!
Controller Code
class PropertyController extends Controller
{
public function details($id)
{
$property = Property::with('attributes', 'addons', 'distributions', 'images', 'attributes_2', 'services')
->where('prop_id', $id)
->first();
// dd($property);
return view('pages.processes.offerdemand.matchs.propertymodal', compact('property'));
}
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UugWSL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire