Level 6
It seems that the table with the name "projectvouchertype" was not found.
Maybe you have a typo?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to query a releationship like this:
$first = Projectvoucheritem::select('*','rentalstop AS tdate')
->with('transmissionbegin')
->with('transmissionend')
->with('transmissiondrivers.users')
->whereNotNull('rentalstop')
->whereDate('rentalstop', '>=', $start)
->whereDate('rentalstop', '<=', $end)
->with(['projectvoucher.projectvouchertype' => function ($query) {
$query->where('internalname', \App\Models\Projectvouchertype::NAME_RESERVATION)->orWhere('projectvoucher.projectvouchertype.internalname', \App\Models\Projectvouchertype::NAME_ORDER);
}]);
But when I try it like this, I get this error:
SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "projectvouchertype" LINE 1: ...hertypes"."id" in () and "internalname" = or "projectvo... ^ (SQL: select * from "projectvouchertypes" where ("projectvouchertypes"."id" in (4) and "internalname" = reservation or "projectvoucher"."projectvouchertype"."internalname" = order) and "projectvouchertypes"."deleted_at" is null)
What I am missing here?
Please or to participate in this conversation.