File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function index(Request $request) {
2929 ]);
3030
3131 $ params = array_merge (self ::$ defaultParams , $ request ->input ());
32- $ query = Wiki::query ();
32+ $ query = Wiki::query ()-> with ( ' wikiLatestProfile ' ) ;
3333
3434 if (array_key_exists ('is_featured ' , $ params )) {
3535 $ query = $ query ->where ([
Original file line number Diff line number Diff line change @@ -16,6 +16,21 @@ public function toArray($request): array {
1616 'sitename ' => $ this ->sitename ,
1717 'wiki_site_stats ' => $ this ->wikiSiteStats ,
1818 'logo_url ' => $ logoSetting ? $ logoSetting ->value : null ,
19+
20+ // TODO: delete these three fields before merging; here to easily prove the `reuse_prototype` logic works
21+ 'test_purpose ' => $ this ->wikiLatestProfile ? $ this ->wikiLatestProfile ->purpose : null ,
22+ 'test_temporality ' => $ this ->wikiLatestProfile ? $ this ->wikiLatestProfile ->temporality : null ,
23+ 'test_audience ' => $ this ->wikiLatestProfile ? $ this ->wikiLatestProfile ->audience : null ,
24+
25+ // TODO: As the `$this->wikiLatestProfile` property can be accessed regardless of if
26+ // `->with('wikiLatestProfile')` is used in the controller, we are unable to return null if
27+ // `$this->wikiLatestProfile` isn't set. We should either look into addressing this, or remove the
28+ // `$this->wikiLatestProfile ? ... : null` conditional.
29+ 'reuse_prototype ' => $ this ->wikiLatestProfile
30+ ? $ this ->wikiLatestProfile ->purpose === 'data_hub '
31+ && $ this ->wikiLatestProfile ->temporality === 'permanent '
32+ && $ this ->wikiLatestProfile ->audience === 'wide '
33+ : null ,
1934 ];
2035 }
2136}
Original file line number Diff line number Diff line change 44
55use App \Http \Curl \CurlRequest ;
66use App \Http \Curl \HttpRequest ;
7+ use Illuminate \Database \Events \QueryExecuted ;
78use Illuminate \Queue \Events \JobFailed ;
89use Illuminate \Support \Facades \Queue ;
910use Illuminate \Support \ServiceProvider ;
@@ -25,5 +26,16 @@ public function boot(): void {
2526 $ wrappedException = new \Exception ("Executing Job ' $ name' failed. " , 1 , $ event ->exception );
2627 report ($ wrappedException );
2728 });
29+
30+ // TODO: delete this listener before merging or is it useful to keep in the local environment?
31+ if ($ this ->app ->environment ('local ' )) {
32+ \Event::listen (QueryExecuted::class, function (QueryExecuted $ query ) {
33+ \Log::debug ('Query Executed: ' , [
34+ 'sql ' => $ query ->sql ,
35+ 'bindings ' => $ query ->bindings ,
36+ 'connection ' => $ query ->connectionName ,
37+ ]);
38+ });
39+ }
2840 }
2941}
You can’t perform that action at this time.
0 commit comments