Installation

Create project with composer

composer create-project appdezign/lara-cms-project myapp --prefer-dist

Install NPM

cd myapp

npm install

Publish vendor files

php artisan vendor:publish --tag=lara

Create client theme

cp -R ./laracms/themes/demo ./laracms/themes/myclient

The .env file

Copy .env

cp ./.env.example ./.env

Edit .env

APP_ENV=local

MIX_PARTIAL_PROCESS=
MIX_PROCESS_CSS_ONLY=false

LARA_FRONT_BS_VERSION=5
LARA_PARENT_THEME=base
LARA_CLIENT_THEME=myclient

Run webpack / mix

npx mix

Create database (mysql)

Create a database and a database user, and edit the relevant lines in the .env file. Check the /config/database.php file for the available database connections.

DB_CONNECTION=mysql57
DB_DATABASE=d80_myapp
DB_HOST=localhost
DB_PASSWORD=secret
DB_PORT=3306
DB_USERNAME=u80_myapp

Edit the App Url

APP_URL=https://www.example.com

Setup

Run setup

Make sure that the LARA_NEEDS_SETUP is set to true in your .env file, and run setup

https://www.example.com/setup

If the setup wizard has completed successfully, the LARA_NEEDS_SETUP variable will be set to false by the wizard, and you will be redirected to the backend dashboard.

SASS

Tip: if you are working on your client theme, you can tell Mix to only process the selected theme. This can make theme development a lot faster. The relevant variables can be found in the .env file. Possible values are: base, demo, client, admin

MIX_PARTIAL_PROCESS=client

If you are working on your SCSS files, you can even tell Mix to only process the SCSS files, and skip the JS and assets.

MIX_PROCESS_CSS_ONLY=true

Deploy on web server

If you publish the app to a web server, you should move all project folders (except public) one level down, and put them in a folder called /laravel. If you are using a shared server (e.g. Plesk) and your server uses a public folder with a different name (e.g. httpdocs), you should move all public files and folders from /public to /httpdocs. You can then delete the (empty) public folder.

Your folder structure should look like this now:

/httpdocs
    /assets
/laravel
    /app
    /bootstrap
    /config
    ...

You should now edit your .env file:

LFM_PUBLIC_BASE_DIR=../httpdocs

... and your webpack.mix.js file:

const PUBLIC_ASSET_PATH = './../httpdocs/assets/';

... and, if necessary, the bootstrap/app.php file

$app->usePublicPath(realpath(base_path('../httpdocs')));

Tip: if you are copying your Lara project from your local machine to a web server with FTP, you should exclude the following folders:

/laracms/core

/laracms/themes

/node_modules

/vendor

Make sure that both composer.json, and composer.lock are copied to your web server, and run composer install on your server.

If you are running composer as root, you need to change the ownership of the relevant folders and files:

chown -R [system_user]:psacln ./httpdocs/assets chown -R [system_user]:psacln ./laravel/laracms chown -R [system_user]:psacln ./laravel/resources chown -R [system_user]:psacln ./laravel/vendor

Last updated