From 52cbc232106bae1dcc64708f485a4f70aba0305a Mon Sep 17 00:00:00 2001 From: Hans Schouten Date: Sat, 21 Mar 2020 14:56:07 +0100 Subject: [PATCH] Create theme command added --- README.md | 5 +++- src/Commands/CreateTheme.php | 37 +++++++++++++++++++++++++++ src/ServiceProvider.php | 8 ++++++ themes/stub/blocks/header/view.html | 2 ++ themes/stub/layouts/master/layout.php | 12 +++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/Commands/CreateTheme.php create mode 100644 themes/stub/blocks/header/view.html create mode 100644 themes/stub/layouts/master/layout.php diff --git a/README.md b/README.md index 331d2f5..38db22d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,10 @@ Follow these steps to install Laravel Pagebuilder in your project: - Update the configuration in `config/pagebuilder.php` - `php artisan migrate` -Next, you can publish the demo theme: +Next, you need to create a theme: +- `php artisan pagebuilder:create-theme [name here]` + +.. or publish the demo theme: - `php artisan vendor:publish --provider="HansSchouten\LaravelPageBuilder\ServiceProvider" --tag=demo-theme` Now you are able to login via `/admin` with `admin` and `changethispassword` (the admin URL and credentials can be changed in the pagebuilder config file). diff --git a/src/Commands/CreateTheme.php b/src/Commands/CreateTheme.php new file mode 100644 index 0000000..5da02d2 --- /dev/null +++ b/src/Commands/CreateTheme.php @@ -0,0 +1,37 @@ +argument('name'); + $themePath = base_path(config('pagebuilder.theme.folder_url') . '/' . $themeName); + File::copyDirectory(__DIR__ . '/../../themes/stub', $themePath); + } + +} diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 59cff1c..cc6813f 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -2,6 +2,8 @@ namespace HansSchouten\LaravelPageBuilder; +use HansSchouten\LaravelPageBuilder\Commands\CreateTheme; + class ServiceProvider extends \Illuminate\Support\ServiceProvider { /** @@ -23,6 +25,12 @@ public function boot() $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); $this->loadMigrationsFrom(__DIR__ . '/../migrations'); + if ($this->app->runningInConsole()) { + $this->commands([ + CreateTheme::class, + ]); + } + $this->publishes([ __DIR__ . '/../config/pagebuilder.php' => config_path('pagebuilder.php'), ], 'config'); diff --git a/themes/stub/blocks/header/view.html b/themes/stub/blocks/header/view.html new file mode 100644 index 0000000..3306939 --- /dev/null +++ b/themes/stub/blocks/header/view.html @@ -0,0 +1,2 @@ +
+
diff --git a/themes/stub/layouts/master/layout.php b/themes/stub/layouts/master/layout.php new file mode 100644 index 0000000..0d88df1 --- /dev/null +++ b/themes/stub/layouts/master/layout.php @@ -0,0 +1,12 @@ + + + + + <?= $page->title ?> + + + + + + +