@@ -40,12 +40,12 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | - $students = DB::table('examination_students as es') |
|
| 44 | - ->select(DB::raw('count(*) as total'),'e2.*') |
|
| 45 | - ->join('examination_students as e2','es.nsid','e2.nsid') |
|
| 46 | - ->having('total','>',1) |
|
| 47 | - ->groupBy('e2.st_no') |
|
| 48 | - ->orderBy('e2.st_no') |
|
| 43 | + $students = DB::table('examination_students as es') |
|
| 44 | + ->select(DB::raw('count(*) as total'),'e2.*') |
|
| 45 | + ->join('examination_students as e2','es.nsid','e2.nsid') |
|
| 46 | + ->having('total','>',1) |
|
| 47 | + ->groupBy('e2.st_no') |
|
| 48 | + ->orderBy('e2.st_no') |
|
| 49 | 49 | ->get(); |
| 50 | 50 | $this->output->writeln(count($students).'entries found'); |
| 51 | 51 | |
@@ -41,16 +41,16 @@ |
||
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | 43 | $students = DB::table('examination_students as es') |
| 44 | - ->select(DB::raw('count(*) as total'),'e2.*') |
|
| 45 | - ->join('examination_students as e2','es.nsid','e2.nsid') |
|
| 46 | - ->having('total','>',1) |
|
| 44 | + ->select(DB::raw('count(*) as total'), 'e2.*') |
|
| 45 | + ->join('examination_students as e2', 'es.nsid', 'e2.nsid') |
|
| 46 | + ->having('total', '>', 1) |
|
| 47 | 47 | ->groupBy('e2.st_no') |
| 48 | 48 | ->orderBy('e2.st_no') |
| 49 | 49 | ->get(); |
| 50 | 50 | $this->output->writeln(count($students).'entries found'); |
| 51 | 51 | |
| 52 | - foreach($students as $student){ |
|
| 53 | - Examination_student::where('st_no',$student->st_no)->update(['nsid'=>'']); |
|
| 52 | + foreach ($students as $student) { |
|
| 53 | + Examination_student::where('st_no', $student->st_no)->update(['nsid'=>'']); |
|
| 54 | 54 | $this->output->writeln($student->st_no.'removed'); |
| 55 | 55 | } |
| 56 | 56 | } |