You are fetching the same data twice by using the find() in both lines. You could just use the query you have for $campaignStatus. That query would return a Collection object with both the variables you are passing to your view.
Or try using the one query:
$campaign = Campaign::find($id)->campaignStatus;
Using
$campaign = Campaign::find($id);
will populate the $campaign with model data, Since id is already set, now you can get the comaign status like ( another find call was not needed ):
$status = $campaign->campaignStatus;
//or
$status = $campaign->campaignStatus()->first();
this will return the related stutus for the campaign.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community