Skip to content

Commit 05b7cd2

Browse files
authored
Update CrudBackpackCommand.php
updated with conditional :)
1 parent 98dd563 commit 05b7cd2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Console/Commands/CrudBackpackCommand.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ public function handle()
7878
$this->call('route:cache');
7979
}
8080

81-
$url = Str::of(config('app.url'))->finish('/')
82-
->append(
83-
(!empty(config('backpack.base.route_prefix'))
84-
? config('backpack.base.route_prefix') . '/'
85-
: '') . $nameKebab
86-
);
81+
$routePrefix = config('backpack.base.route_prefix');
82+
83+
$url = Str::of(config('app.url'))
84+
->finish('/')
85+
->when($routePrefix !== '', function ($string) use ($routePrefix) {
86+
return $string->append($routePrefix)->finish('/');
87+
})
88+
->append($nameKebab);
8789

8890
$this->newLine();
8991
$this->line(" Done! Go to <fg=blue>$url</> to see the CRUD in action.");

0 commit comments

Comments
 (0)