File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1313class RoomController extends Controller
1414{
1515 public function index ($ id_room ){
16- $ room = Room::all ()->where ('kode ' , $ id_room );
16+ $ room = Room::all ()->where ('kode ' , $ id_room )->first ();
17+ if ($ room ->status == 0 ){
18+ # waiting room
19+ }
20+ else if ($ room ->status == 1 ){
21+ $ kumpulan_soal = $ this ->getAllSoalForRoom ($ room );
22+ dd ($ kumpulan_soal );
23+ return view ('room ' , compact ('kumpulan_soal ' ));
24+ }
1725 }
1826
1927 public function create (){
@@ -137,8 +145,7 @@ private function generateRandomString($length=10){
137145 return $ randomString ;
138146 }
139147
140- private function getAllSoalForRoom ($ id_room ){
141- $ room = Room::all ()->where ('kode ' , $ id_room );
148+ private function getAllSoalForRoom ($ room ){
142149 $ paket_soal = $ room ->paket_id ;
143150 $ paket_soal = explode ('| ' , $ paket_soal );
144151 $ kumpulan_soal = array ();
@@ -154,6 +161,7 @@ private function getSoalFromPaket($id_paket){
154161 foreach ($ soals as $ soal ){
155162 array_push ($ kumpulan_soal , $ this ->translateSoal ($ soal ));
156163 }
164+ return $ kumpulan_soal ;
157165 }
158166
159167 private function translateSoal ($ soal ){
You can’t perform that action at this time.
0 commit comments