AgreementType::whereNotNull('last_agreement_id')->withLastApprovedByProfile($profile->id)->where('last_agreement_approved', false);
генерит такой вот запрос:select
`agreement_types`.*,
exists(select * from `agreement_profile` where `agreement_types`.`last_agreement_id` = `agreement_profile`.`agreement_id` and `profile_id` = ?) as `last_agreement_approved`
from `agreement_types`
where
`last_agreement_id` is not null
and `last_agreement_approved` = ?
order by
`name` asc
Unknown column 'last_agreement_approved' in 'where clause'
, надо делать отдельный скоупpublic function scopeWhereLastNotApprovedByProfile(Builder $query, string $profileId): void
{
$query->whereDoesntHave('lastApproved', function ($q) use ($profileId) {
$q->where('profile_id', $profileId);
})
}
тогда exists переедет в where:select
`agreement_types`.*
from `agreement_types`
where
`last_agreement_id` is not null
and not exists (select * from `agreement_profile` where `agreement_types`.`last_agreement_id` = `agreement_profile`.`agreement_id` and `profile_id` = ?)
order by
`name` asc
нужно либо запретить сжиматься
Какой-нибудь date-fns
а зачем в роутере что-то проверять?
нет. проблема в том, что ларавель нужен как минимум для рендеринга view. проще тогда уж сделать обычный фронт рядом, разместить в двух проектах (потом можно будет настроить вебсервер так, чтобы ларавеловский "бэк" был в подпапке). все исходники в одну папку кидать точно не следует.
ну так надо настроить подключение к бд (хоть sqlite, но там могут быть ограничения).