Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

I suppose I'll have to do

@if($item->attachedto_type=='Company')
    @include('partials.companydetails',['company' => $item->company])
@elseif($item->attachedto_type=='Person')
    @include('partials.persondetails',['person' => $item->person])
@else
    @include('partials.chooseattached')
@endif

better yet

@if($item->attachedto_type)
    @include('partials.'.$item->attachedto_type.'details',['company' => $item->company, 'person' => $item->person])
@else
    @include('partials.chooseattached')
@endif

or

@if($item->attachedto_type)
    @include('partials.'.$item->attachedto_type.'details',['details' => $item->attachedto])
@else
    @include('partials.chooseattached')
@endif
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.