forked from HansSchouten/Laravel-Pagebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish theme and publish demo theme commands added
- Loading branch information
1 parent
fa8d51d
commit a8dde6e
Showing
6 changed files
with
100 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace HansSchouten\LaravelPageBuilder\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Exception; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class PublishDemo extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'pagebuilder:publish-demo'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Publish the demo theme.'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @throws Exception | ||
*/ | ||
public function handle() | ||
{ | ||
Artisan::call('vendor:publish', [ | ||
'--provider' => 'HansSchouten\LaravelPageBuilder\ServiceProvider', | ||
'--tag' => 'demo-theme' | ||
]); | ||
Artisan::call('pagebuilder:publish-theme', ['theme' => 'demo']); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace HansSchouten\LaravelPageBuilder\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Exception; | ||
|
||
class PublishTheme extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'pagebuilder:publish-theme {theme}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Create for the given theme a folder in /public and symlink to the public folder of the theme.'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @throws Exception | ||
*/ | ||
public function handle() | ||
{ | ||
$theme = basename($this->argument('theme')); | ||
|
||
$themePublicFolder = config('pagebuilder.theme.folder') . "/{$theme}/public"; | ||
if (! file_exists($themePublicFolder)) { | ||
return $this->error("The folder {$themePublicFolder} does not exist."); | ||
} | ||
|
||
if (! file_exists(public_path("themes"))) { | ||
mkdir(public_path("themes")); | ||
} | ||
|
||
$publicThemeFolder = public_path("themes/{$theme}"); | ||
if (file_exists($publicThemeFolder)) { | ||
return $this->error( "The 'public/{$theme}' directory already exists."); | ||
} | ||
|
||
$this->laravel->make('files')->link( | ||
$themePublicFolder, $publicThemeFolder | ||
); | ||
|
||
return $this->info("The public directory of the {$theme} theme has been linked."); | ||
} | ||
|
||
} |
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
File renamed without changes.