Installation

Laravel

In order to start building your project with GreenLight, you need a working Laravel 5.7+ instance. Regarding the installation procedure of Laravel you can find information in the official documentation site of the framework.

Make sure you have all environment and config values set correctly to proceed further to the package installation. Also, in order to avoid migration conflicts, make sure you either skip running the migrations of your fresh Laravel install, or use your own, customized migrations derived from GreenLight.

GreenLight

1. Composer install

Since GreenLight is a private package only published to GitHub, you need minor adjustments to your composer.json file to make sure you can add it to your project.

Adding the GreenLight repository to your composer repository definitions:

"repositories": [
     {
         "type": "vcs",
         "url": "https://github.com/greenroomgit/greenlight.git"
     }
 ],

Loading the package via composer:

composer require greenroom/greenlight

2. Publishing resources of the package

Before starting work with GreenLight, you will need to run the following commands to publish several resources used by the package. These publish commands are:

Core elements
php artisan vendor:publish --tag=greenlight-init --force
Optional

Frontend development boilerplate:

php artisan vendor:publish --tag=greenlight-frontend --force

Admin resources (only to be used to update admin resources after a GreenLight update):

php artisan vendor:publish --tag=greenlight-admin --force

3. Migrations

In case you are planning to build your project entirely using GreenLight, it is recommended to remove the default migration files of Laravel (database/migrations) to avoid conflicts!

GreenLight comes with a simple CRUD interface. In order to use it and most of the pre-defined sections of the package, you will need to run the migrations included. Before that, make sure you created an empty database with utf8mb4_general_ci collation and edited the .env file of your project with your actual database parameters!

By default the package already loads all migration files while running your Laravel instance, all you have to do is run the migration command as you would do in any Laravel project:

php artisan migrate

Also, it is recommended to run the GreenLight database seeder, so you would not have to worry about generating initial records for your system:

php artisan db:seed --class=Greenroom\GreenLight\Database\Seeds\DatabaseSeeder

5. Recommended changes in your Laravel app

  1. Create a Models subfolder in your app folder
  2. Make sure locales (both default and fallback) and timezone are set correctly in config/app.php
  3. Consider changing the user provider model in config/auth.php (providers / users / model). In case you are planning to use your own user model, make sure it uses the LaratrustUserTrait. If you are not, remove the default User model coming with Laravel (app/User.php)
  4. If needed, set available locales (has to be a one-dimensional array) and fallback options in config/translatable.php
  5. Set the following parameters in your .env file: SITE (name of the site), LOCALE_HU, LOCALE_EN, etc (given values should represent the corresponding locale name in your system, for example: en-US.utf8)
  6. Consider changing Laratrust config values in config/laratrust.php. It is recommended to either use the models GreenLight provides for Laratrust, or to publish your own user handler models from Laratrust. Docs: https://laratrust.santigarcor.me/.