📅  最后修改于: 2022-03-11 14:54:46.404000             🧑  作者: Mango
class BookController extends Controller
{
public function bookIndex($id, $slug) {
// echo $id works without a problem
$findcover = Thing::with(array('cover' => function($query) use ($id) {
$query->where('imageable_type', 'App\Models\Thing')
->where('imageable_id', $id);
}))->find($id);
$maincover = $findcover->cover;
}