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.
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
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:
php artisan vendor:publish --tag=greenlight-init --force
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
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
Models
subfolder in your app
folderconfig/app.php
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)config/translatable.php
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/.