Support the ongoing development of Laravel.io →
posted 9 years ago
Views Blade
Last updated 2 years ago.
0

Is there a reason you're specifying the array key (main_issue[0])?

0

I need the main_issue from first iteration of array main_issue. Is there any other I can get main_issue from the array main_issue?

Thanks.

0

I tried <td>{{ $subIssue->main_issue->first()->main_issue }} </td>

getting an error "Trying to get property of non-object (View: "

Any help??

Here are the model & controller code.. public function SubIssue() { return $this->belongsTo('App\Models\Issues\SubIssue', 'main_issue_id','sub_issue_main_issue_id'); /**

  • Relation between sub issue and main issue */ public function MainIssue() { return $this->hasMany('App\Models\Issues\MainIssue', 'main_issue_id', 'sub_issue_main_issue_id'); }

Controller: $mainIssues = $mainIssue->where('main_issue_user_id', $id)->get(); return view('issues.mainIssues.mainIssues', compact('mainIssues')); }

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

bpattan bpattan Joined 17 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.