Skip to content

Commit be6cd43

Browse files
committed
Update How to set up a brand new CMS website with the latest Laravel
1 parent 4e82560 commit be6cd43

File tree

2 files changed

+38
-23
lines changed

2 files changed

+38
-23
lines changed

README.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
- Build-in Website is ready after install. Easy to use, simple enough but flexible.
1313
- Basic Laravel 8.x/ Laravel 7.x /Laravel 6.x / Laravel 5.x syntax and blade template, no need to learn a "new language"
1414

15-
## How to install & uninstall (Support Laravel 8.x & Laravel 7.x & Laravel 6.x & Laravel 5.x)
15+
## How to install for an existing Laravel project
16+
- Support Laravel 8.x & Laravel 7.x & Laravel 6.x & Laravel 5.x
1617

1718
```php
18-
// Make sure you already configured the database in the .env
19-
// Go to the laravel project folder and install it via composer
19+
// Make sure you already have laravel installed and configured the database in the .env
20+
// Go to your laravel project folder and install it via composer
2021
// Initialize the CMS (You can set up database table prefix and locale here)
2122

2223
composer require alexstack/laravel-cms && php artisan laravelcms
@@ -25,7 +26,40 @@ composer require alexstack/laravel-cms && php artisan laravelcms
2526
// Now you can access the cms frontend site: http://yourdomain/cms-home
2627

2728
// Access the backend with the FIRST USER of your site: http://yourdomain/cmsadmin
29+
```
30+
31+
## How to set up a brand new CMS website with the latest Laravel
32+
33+
- It's good for a local testing, it's support the latest Laravel version
34+
35+
```php
36+
// Step 1: Install Laravel to folder cms
37+
composer create-project --prefer-dist laravel/laravel cms && cd cms && composer require alexstack/laravel-cms
38+
39+
// Step 2: Change the database connection settings in the .env
40+
cd cms & vi .env
41+
42+
// Step 3: install cms
43+
php artisan laravelcms
44+
45+
// Step 4: Enable Laravel auth/login system
46+
composer require laravel/ui && php artisan ui bootstrap --auth && php artisan migrate
47+
48+
// Step 5: Set up a web server via php artisan
49+
php artisan serve
50+
51+
// Step 6: Now, you can access your cms backend via http://127.0.0.1:8080/cmsadmin/
52+
53+
// Tips: You will need to register a new user and the first user will be the admin user of the cms
54+
55+
// Tips: You can initialize the CMS with silent mode
56+
php artisan laravelcms --action=initialize --locale=en --table_prefix=cms_  --silent=yes
2857

58+
```
59+
60+
61+
## How to uninstall
62+
```php
2963
// Uninstall the CMS
3064
php artisan laravelcms --action=uninstall
3165

@@ -186,27 +220,7 @@ php artisan laravelcms --action=clear
186220
- One simple option is to implement a method from your own PHP controller/class by adding it into a cms page. [Tutorial for it.](https://www.laravelcms.tech/Laravel-Advanced-Override-the-page-content-by-your-PHP-Class-method-function.html "Use your PHP class in a Laravel CMS page")
187221
- Another option is to create a CMS plugin for your own project and use it for all pages. [A tutorial is here.](https://www.laravelcms.tech/Laravel-Create-your-own-plugin.html "How to create a Laravel CMS Plugin") You can also publish the plugin if the feature can be used by other websites.
188222

189-
## How to set up a brand new Laravel 6.x or 7.x website & install our CMS
190-
191-
- It's good for a local test
192-
193-
```php
194-
// Install Laravel 6.x/7.x/8.x & the CMS package
195-
composer create-project --prefer-dist laravel/laravel cms && cd cms && composer require alexstack/laravel-cms
196223

197-
// Then you need to change the database settings in the .env after that initialize CMS
198-
cd cms & vi .env
199-
php artisan laravelcms
200-
201-
// Or initialize the CMS with silent mode
202-
php artisan laravelcms --action=initialize --locale=en --table_prefix=cms_  --silent=yes
203-
204-
// Enable auth system for Laravel 6.x/7.x/8.x
205-
composer require laravel/ui && php artisan ui vue --auth && php artisan migrate
206-
207-
// Config the document root to point to the cms/public then you can access the backend
208-
// Tips: You will need to register a new user, the first user will be the admin user
209-
```
210224

211225
## How to upgrade the CMS?
212226

src/Console/Commands/LaravelCMS.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ public function initializeCms($options)
340340
["=> '".$table_prefix, "=> '".$app_locale],
341341
file_get_contents(dirname(__FILE__, 3).'/config/laravel-cms.php')
342342
);
343+
$config_str = trim($config_str); // in case it not change in ram memory
343344
file_put_contents(base_path('config/laravel-cms.php'), $config_str);
344345
$this->line('<fg=cyan>----> Changed db table prefix to : </><fg=yellow>'.$table_prefix.'</>');
345346
}

0 commit comments

Comments
 (0)