Skip to content

Commit f48e2a5

Browse files
cmd info
1 parent 736128d commit f48e2a5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Console/Commands/ButtonBackpackCommand.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace Backpack\Generators\Console\Commands;
44

55
use Illuminate\Console\GeneratorCommand;
6+
use Illuminate\Support\Str;
67

78
class ButtonBackpackCommand extends GeneratorCommand
89
{
10+
use \Backpack\CRUD\app\Console\Commands\Traits\PrettyCommandOutput;
911
/**
1012
* The console command name.
1113
*
@@ -62,8 +64,7 @@ public function handle()
6264
*/
6365
public function fire()
6466
{
65-
$name = $this->getNameInput();
66-
67+
$name = Str::of($this->getNameInput());
6768
$path = $this->getPath($name);
6869

6970
if ($this->alreadyExists($this->getNameInput())) {
@@ -72,10 +73,14 @@ public function fire()
7273
return false;
7374
}
7475

75-
$this->makeDirectory($path);
76+
$this->infoBlock("Creating {$name->replace('_', ' ')->title()} {$this->type}");
77+
$this->progressBlock("Creating view <fg=blue>${path}.blade.php</>");
7678

79+
$this->makeDirectory($path);
7780
$this->files->put($path, $this->buildClass($name));
78-
81+
82+
$this->closeProgressBlock();
83+
$this->newLine();
7984
$this->info($this->type.' created successfully.');
8085
}
8186

@@ -98,7 +103,7 @@ protected function alreadyExists($name)
98103
*/
99104
protected function getPath($name)
100105
{
101-
return $this->laravel['path'].'/../resources/views/vendor/backpack/crud/buttons/'.str_replace('\\', '/', $name).'.blade.php';
106+
return resource_path("views/vendor/backpack/crud/buttons/$name.blade.php");
102107
}
103108

104109
/**

0 commit comments

Comments
 (0)