Skip to content
Snippets Groups Projects
Commit d306f5cb authored by Nicholas Wijaya's avatar Nicholas Wijaya
Browse files

fix bug on create mahasiswa before creating thesis class

parent d3237fa4
Branches
1 merge request!2fix bug on create mahasiswa before creating thesis class
......@@ -109,7 +109,16 @@ class RegisterController extends Controller
Dosen::create(['id'=>$user->id]);
} else if ($role == User::ROLE_MAHASISWA) {
$id_kelas_tesis = KelasTesis::orderByRaw('updated_at - created_at DESC')->first();
Mahasiswa::create(['id'=>$user->id, 'id_kelas_tesis'=>$id_kelas_tesis->id]);
if ($id_kelas_tesis == NULL) {
$user->delete();
echo '<div class="alert alert-warning alert-dismissible fade show text-center">
<button type="button" class="close" data-dismiss="alert">&times;</button>
Please create <strong>Kelas Tesis</strong> first.
</div>';
return view('auth.register');
} else {
Mahasiswa::create(['id'=>$user->id, 'id_kelas_tesis'=>$id_kelas_tesis->id]);
}
} else if ($role == User::ROLE_MANAJER) {
Manajer::create(['id'=>$user->id]);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment