$tbls = DB::select("show tables"); $key = array_keys((array)$tbls[0])[0]; echo "== tables matching solution/answer/working/explanation ==\n"; foreach ($tbls as $t) { $n=$t->$key; if (preg_match('/solution|answer|working|explan|tutor/i',$n)) echo " $n\n"; } foreach (['solutions','question_solutions','question_solution','answers'] as $p) { try { $c=array_map(fn($x)=>$x->Field, DB::select("describe `$p`")); echo "== $p == ".implode(', ',$c)."\n"; echo " sample: ".json_encode(DB::table($p)->limit(2)->get())."\n"; } catch(\Exception $e){} } // does questions have a solution column already populated? echo "== questions.explanation sample for a recent P3 row ==\n"; echo json_encode(DB::table('questions')->where('source','like','% P3 %')->whereNotNull('explanation')->orderByDesc('id')->first(['id','source','explanation']))."\n";