echo "questions containing 'frac': ".DB::table('questions')->where('question','like','%frac%')->count()."\n"; echo "questions containing '\\\\(' (latex inline): ".DB::table('questions')->where('question','like','%\\\\(%')->count()."\n"; echo "questions containing '\$' (latex \$..\$): ".DB::table('questions')->where('question','like','%$%')->count()."\n"; echo "answers like a/b (slash): ".DB::table('questions')->where('answer0','like','%/%')->count()."\n\n"; echo "=== sample PUBLIC (status_id=3) fraction questions (NOT my draft) ===\n"; foreach (DB::table('questions')->where('status_id',3) ->where(function($q){ $q->where('question','like','%frac%')->orWhere('answer0','like','%/%')->orWhere('question','like','%/%'); }) ->inRandomOrder()->limit(8)->get(['id','type_id','question','answer0','answer1','correct_answer']) as $r) { echo "#{$r->id} t{$r->type_id} Q=".substr(str_replace("\n"," ",$r->question),0,110)." | a0=".substr((string)$r->answer0,0,30)." a1=".substr((string)$r->answer1,0,30)."\n"; } echo "\n=== sample solutions containing fractions ===\n"; foreach (DB::table('solutions')->where('source','human')->where('solution','like','%/%')->inRandomOrder()->limit(3)->get(['solution']) as $r) echo "SOL: ".substr(str_replace("\n"," ",$r->solution),0,140)."\n";