0
votes

I'm trying to access a custom pivot class directly through Artisan tinker like this: App\Registration::all(). But it seems that classes that extend pivot are not directly accessible?

The Errormessage: Illuminate/Database/QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'teknologiskolen.registration' doesn't exist (SQL: select * from registration where registration.id = 1 limit 1)'

1
may be you should try \App\Registrations::all() - Adnan Mumtaz
Is Registration the pivot class? Is there an error? - Jonas Staudenmeir
Yeah you'll run into missing parameter issues with trying to access anything that extends pivot directly in that way. It just doesn't work like that. - N Mahurin
@JonasStaudenmeir: Yes, Registration is the pivot class, and @NMahurin I guess I'll have to access it through the related classes then... - Jacob Nielsen
What's the actual pivot table? You can specify it with protected $table = '...'; - Jonas Staudenmeir

1 Answers

0
votes

Specify the table in the pivot model:

class Registration extends Pivot {
    protected $table = 'registrations';
}