2 months ago

Is there a way to see what Laravel is expecting for the magic behind the scenes?

Posted 2 months ago by chrisgrim

I have two models, Event and Interactive Level. Event belongs to Interactive Level and Interactive Level can have many events. In my migration I have

 Schema::create('interactive_levels', function (Blueprint $table)

so in my event model I created


I assumed this would connect the two in the back end with Laravel's magic but it doesn't work. If I do


nothing happens. However if I add my own foreign key like so

    public function interactivelevel() 
        return $this->belongsTo(InteractiveLevel::class, 'interactive_level_id');

it works. Is there a way for me to see what Laravel is looking for as a foreign key?? Sorta like Route:list but for foreign keys.

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