dadub
6 days ago
326
7
Laravel

Reach a value of an object

Posted 6 days ago by dadub

Hi everybody,

I have this object :

Part 1 of the object :

https://www.dropbox.com/s/p5v9j3hj0yrqy0q/Capture%20d%27%C3%A9cran%202020-05-22%2017.15.01.png?dl=0

Part 2 of the object :

https://www.dropbox.com/s/s544edbkjo34lc0/Capture%20d%27%C3%A9cran%202020-05-22%2017.15.13.png?dl=0

I would like to get the value inside de border (see link Part 2 of the object).

My code :

It's a many to many, I have 2 models :

Model Hinteraction :

public function effects() {
        //DD: une hinteraction peut avoir plusieurs effets et un effet peut se trouver dans plusieurs hinteractions 
        return $this->belongsToMany(Effect::class, 'hinteraction_has_effects'); 
    }

Model Effect :

class Effect extends Model
{
    //DD: une hinteraction peut avoir plusieurs effets et un effet peut se trouver dans plusieurs hinteractions
    public function hinteractions() 
{ 
        return $this->belongsToMany(Hinteraction::class, 'hinteraction_has_effects'); 
}
            $hinteractions_has_effects = Hinteraction::with('effects')->get();

I tried to make this :

@foreach ($hinteractions_has_effects as $effect)
	{{$effect->name}}	
@endforeach

But I don't have no name.

Thank you in advance for your help.

Please sign in or create an account to participate in this conversation.