-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
10 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
<?php | ||
|
||
namespace Backpack\Generators\Console\Commands\Traits; | ||
use Illuminate\Support\Str; | ||
|
||
trait PublishableStubTrait | ||
{ | ||
/** | ||
* Check if the stub exists in the project's stubs folder. | ||
* If it does, return the path to it. | ||
* If it doesn't, return the path to the stub in the package. | ||
* | ||
* @param string $path | ||
* @return string | ||
* Return the path to the stub | ||
*/ | ||
public function getStubPath(string $path): string | ||
{ | ||
if (file_exists(base_path("stubs/backpack/generators/{$path}.stub"))) { | ||
return base_path("stubs/backpack/generators/{$path}.stub"); | ||
$path = Str::finish($path, '.stub'); | ||
|
||
if (file_exists(base_path("stubs/backpack/generators/{$path}"))) { | ||
return base_path("stubs/backpack/generators/{$path}"); | ||
} | ||
|
||
return __DIR__."/../../stubs/{$path}.stub"; | ||
return __DIR__."/../../stubs/{$path}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters