File tree Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ "name" : " laravel9-mongodb-tutorial" ,
3
+
2
4
// Mandatory definition for .devcontainer
3
5
//
4
6
// which service AS DEFINED IN .devcontainer/docker-compose.yml
10
12
// so we'll use a compose .yml file instead of defining the services in devcontainer.json
11
13
"dockerComposeFile" : " ./docker-compose.yml" ,
12
14
15
+ "shutdownAction" : " stopCompose" ,
16
+
13
17
// Mandatory definition for .devcontainer
14
18
//
15
19
// workspaceFolder describes the CONTAINER folder
37
41
}
38
42
},
39
43
40
- "forwardPorts" : [80 ]
44
+ "forwardPorts" : [80 ],
45
+
46
+ // execute our one-time repo init if /vendor/ does not exist
47
+ "postCreateCommand" : " sh init_repo.sh"
41
48
}
Original file line number Diff line number Diff line change 52
52
return ['msg ' => $ msg ];
53
53
});
54
54
55
+ /*
56
+ Laravel check on the MySQL connection
57
+ */
58
+ Route::get ('/test_mysql/ ' , function (Request $ request ) {
59
+ try {
60
+ DB ::connection ()->getPdo ();
61
+ return ['status ' => 'executed ' , 'data ' => 'Successfully connected to the DB. ' ];
62
+ } catch (\Exception $ e ) {
63
+ return ['status ' => 'FAIL. exception ' , 'data ' => $ e ];
64
+ }
65
+ });
66
+
55
67
/*
56
68
Create a new "customer" in our SQL database
57
69
This is just to show the code looks identical to the MongoDB version
263
275
$ result = DB ::connection ('mongodb ' )->getCollection ('laracoll ' )->createIndex ($ indexKeys , $ indexOptions );
264
276
265
277
return ['status ' => 'executed ' , 'data ' => $ result ];
266
- });
267
-
268
-
269
- /*
270
- Laravel check on the MySQL connection
271
- */
272
- Route::get ('/test_mysql/ ' , function (Request $ request ) {
273
- try {
274
- DB ::connection ()->getPdo ();
275
- return ['status ' => 'executed ' , 'data ' => 'Successfully connected to the DB. ' ];
276
- } catch (\Exception $ e ) {
277
- return ['status ' => 'FAIL. exception ' , 'data ' => $ e ];
278
- }
279
278
});
You can’t perform that action at this time.
0 commit comments