2121use bdk \ErrorHandler \Error ;
2222use Illuminate \Contracts \Http \Kernel ;
2323use Illuminate \Support \ServiceProvider as BaseServiceProvider ;
24+ use ReflectionClass ;
2425
2526/**
2627 * PhpDebugConsole
@@ -31,6 +32,7 @@ class ServiceProvider extends BaseServiceProvider
3132 protected $ modelCounts = array ();
3233 private $ isLumen = false ;
3334 private $ logViews ;
35+ private $ logDb ;
3436
3537 /**
3638 * Register services.
@@ -103,16 +105,18 @@ public function onOutput()
103105 'nested ' => false ,
104106 );
105107 $ debug = $ this ->debug ->getChannel ($ channelKey , $ channelOptions );
106- $ tableInfoRows = array ();
107- $ modelCounts = $ this ->buildModelCountTable ($ tableInfoRows );
108+ $ modelCounts = $ this ->buildModelCountTable ();
108109 $ debug ->table ('Model Usage ' , $ modelCounts , $ debug ->meta (array (
109- 'columnLabels ' => array (
110- \bdk \Table \Factory::KEY_INDEX => 'model ' ,
111- \bdk \Table \Factory::KEY_SCALAR => 'count ' ,
110+ 'columnMeta ' => array (
111+ 'model ' => array (
112+ 'attribs ' => array (
113+ 'scope ' => 'row ' ,
114+ ),
115+ 'tagName ' => 'th ' ,
116+ ),
112117 ),
113- 'detectFiles ' => true ,
114- 'sortable ' => true ,
115- 'totalCols ' => [\bdk \Table \Factory::KEY_SCALAR ],
118+ 'inclIndex ' => false ,
119+ 'totalCols ' => ['count ' ],
116120 )));
117121 }
118122
@@ -132,25 +136,22 @@ public function shouldCollect($name, $default = false)
132136 /**
133137 * Process the stored model counts for outputting as table
134138 *
135- * @param array $tableInfoRows gets updated with tableInfo.rows for table
136- *
137139 * @return array
138140 */
139- private function buildModelCountTable (& $ tableInfoRows )
141+ private function buildModelCountTable ()
140142 {
141143 $ modelCounts = array ();
142- $ tableInfoRows = array ();
143144 foreach ($ this ->modelCounts as $ class => $ count ) {
144- $ ref = new \ReflectionClass ($ class );
145- $ modelCounts [] = $ count ;
146- $ tableInfoRows [] = array (
147- 'key ' => $ this ->debug ->abstracter ->crateWithVals ($ class , array (
145+ $ ref = new ReflectionClass ($ class );
146+ $ modelCounts [] = array (
147+ 'model ' => $ this ->debug ->abstracter ->crateWithVals ($ class , array (
148148 'attribs ' => array (
149149 'data-file ' => $ ref ->getFileName (),
150150 ),
151151 'type ' => Type::TYPE_IDENTIFIER ,
152152 'typeMore ' => Type::TYPE_IDENTIFIER_CLASSNAME ,
153153 )),
154+ 'count ' => $ count ,
154155 );
155156 }
156157 return $ modelCounts ;
0 commit comments