Created
August 25, 2018 14:00
-
-
Save digitalkreativ/1220ede8bc14cc40a2af071fd532dad0 to your computer and use it in GitHub Desktop.
Laravel Zero adding extra files to the phar build
This file contains hidden or 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
<?php | |
// Put this file in config directory | |
return [ | |
/* | |
|--------------------------------- | |
| STRUCTURE | |
|--------------------------------- | |
| | |
| Adds extra folders or files to the phar file when running app:build-custom | |
| | |
*/ | |
'structure' => [ | |
'resources/', | |
] | |
]; |
This file contains hidden or 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
<?php | |
// Put this file in app/Commands directory | |
namespace App\Commands; | |
use LaravelZero\Framework\Commands\App\Builder; | |
class CustomBuilder extends Builder | |
{ | |
/** | |
* The signature of the command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'app:build-custom {name=application : The build name} {--with-dev : Whether the dev dependencies should be included}'; | |
/** | |
* The description of the command. | |
* | |
* @var string | |
*/ | |
protected $description = 'Create the necessary docker setup files in _docker folder'; | |
public function handle(): void | |
{ | |
$customStructure = config('build-custom.structure') ?? []; | |
if( is_array( $customStructure ) && !empty( $customStructure ) ){ | |
$this->task('Add extra structure', function() use ($customStructure ){ | |
$this->structure = array_merge( $customStructure, $this->structure ); | |
return true; | |
}); | |
} | |
parent::handle(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment