Skip to content

Commit

Permalink
add output message
Browse files Browse the repository at this point in the history
  • Loading branch information
William Feller committed Jul 28, 2019
1 parent c941139 commit 03e70db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Commands/DiscoverChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use hanneskod\classtools\Iterator\ClassIterator;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Symfony\Component\Finder\Finder;
use Tightenco\Parental\HasChildren;
Expand All @@ -18,11 +19,17 @@ class DiscoverChildren extends Command

public function handle()
{
$children = $this->findChildren();

file_put_contents(
$this->path(),
'<?php'.PHP_EOL.PHP_EOL.'return '.var_export($this->findChildren(), true).';'.PHP_EOL
'<?php'.PHP_EOL.PHP_EOL.'return '.var_export($children, true).';'.PHP_EOL
);

$count = count(Arr::flatten($children));

$this->output->writeln("Parental: Successfully discovered {$count} child classes!");

return true;
}

Expand Down

0 comments on commit 03e70db

Please sign in to comment.