@@ -22,10 +22,14 @@ public function __construct(
22
22
/**
23
23
* get list table restaurant
24
24
*/
25
- public function index ()
25
+ public function index (Request $ request )
26
26
{
27
27
$ list_restaurant = $ this ->restaurantService ->getRestaurants ();
28
- $ restaurant = $ list_restaurant ->first ();
28
+ if ($ request ->input ('restaurant_id ' )) {
29
+ $ restaurant = $ list_restaurant ->where ('id ' , $ request ->input ('restaurant_id ' ))->first ();
30
+ }else {
31
+ $ restaurant = $ list_restaurant ->first ();
32
+ }
29
33
return view ('admin.table_setting.index ' , compact ('list_restaurant ' ,'restaurant ' ));
30
34
}
31
35
@@ -35,12 +39,28 @@ public function index()
35
39
*/
36
40
public function createQrCode (Request $ request )
37
41
{
38
- $ url = 'https://example.com ' ;
42
+ $ restaurant_id = $ request ->restaurant_id ;
43
+ $ table_id = $ request ->table_id ;
44
+ $ url = route ('client.home ' ) . '?restaurant_id= ' . $ restaurant_id . '&table_id= ' . $ table_id ;
39
45
$ qrCode = QrCode::size (300 )->generate ($ url );
40
46
41
- $ filename = 'qr_code .svg ' ;
42
- $ path = 'qr_codes/ ' . $ filename ;
47
+ $ filename = 'restaurant_id_ ' . $ restaurant_id . ' _table_id_ ' . $ table_id . ' .svg ' ;
48
+ $ path = 'public/ qr_codes/ ' . $ filename ;
43
49
44
50
Storage::disk ('local ' )->put ($ path , $ qrCode );
51
+
52
+ $ table = $ this ->restaurantService ->createTable ($ request ->all (), $ filename );
53
+ $ modal = view ('admin.table_setting.partials._modal-show ' , compact ('table ' ))->render ();
54
+ return response ()->json ($ modal );
55
+ }
56
+
57
+ /**
58
+ * show qr code blade
59
+ */
60
+ public function showQrCode (Request $ request )
61
+ {
62
+ $ table = $ this ->restaurantService ->findTable ($ request ->all ());
63
+ $ modal = view ('admin.table_setting.partials._modal-show ' , compact ('table ' ))->render ();
64
+ return response ()->json ($ modal );
45
65
}
46
66
}
0 commit comments