Есть ли способ автозагрузки отношений с помощью findByOrFail (или любого другого метода, например find et c.)?
В приведенном ниже коде метод with()
не определен.
async show({ params, response }) {
try {
return await Company.findByOrFail('domain', params.id).with('websites')
} catch (error) {
console.error(error)
switch (error.name) {
case 'ModelNotFoundException':
return response.notFound({ message: 'companies_show_not_found' })
default:
return response.badRequest({ message: 'something_went_wrong' })
}
}
}