<p align="center">
<img height="30px" src="https://www.eae.pt/images/icons/logo-white.svg"> 
EAST ATLANTIC ENGINEERING
</p>


## Installation
This EAE Base CMS is built on Laravel 8.0, which has 
these [requirements](https://laravel.com/docs/8.0/installation#server-requirements).

1. You need to copy the .env.example to .env . There you have to set the following:

   * **APP_NAME** - Usually the name of the project. If the name has spaces you need to enclose it in quotes
   * **APP_ENV** - Environment you are running the project. If you are running locally put **local**
   * **APP_DEBUG** - Set to true if you what to see the error stack screen
   * **APP_URL** - The base url for your website. It does not finish with trailing slashes (ex:http://eae-base-cms.lndo.site)
   * **DB_*** - Set the appropriate database credentials. The example credential are correct if you are running lando
   * **MAIL_*** Set the appropriate email service credentials. The example is correct if you are running lando and you what to 
send the emails to mailhog
   * **EAE_ADMIN_DEFAULT_PASSWORD** - Set the default admin password when creating the project. This will be used when you run 
the database seeders
   * **EAE_RECAPTCHA_*** - Set the google recaptcha keys. The backoffice is using recapcha v3
   * **EAE_GOOGLE_API_KEY** - Set the google maps javascript api key

2. Run `lando start` (optional if you are not running lando)

3. Run `composer install` or  `lando composer install` (the last one if you are running lando)

4. Run `lando artisan key:generate` to generate the APP_KEY in .env

5. Run `lando artisan migrate && lando artisan migrate --path="/database/migrations/project"`

6. Run `lando artisan db:seed`
    - When seeding the DB two example menus will be added to the Menus Table. Change/Add/Remove the menus as necessary.

7. Better yet, just run `lando prep-db`

8. Run `lando artisan storage:link` to create the link for the storage, to be able to access the uploaded media

After this you should be able to access with APP_URL\admin. 
- Username is `admin`
- Password is the one defined in .env as EAE_ADMIN_DEFAULT_PASSWORD 
- If in development environment (lando) you can check the APP URL with `lando info`

### Tests
- Laravel Dusk is available to perform browser tests. 
    - To run it simply type `lando test-dusk`.
    - The tests can be found (and more added) at tests/browser/.
    - **ATTENTION** Running `lando test-dusk` will erase the DB content and drop tables in the end
    - Dusk sometimes fails tests for reasons not related with the subject of the test (for example, wrong test session-id). 
        - Also, tests can fail if the previous test failed and left the environment in a non-optimal state.
        - If this happens run the test suite again.
        - If it still happens, run `lando rebuild` and try again.
- If you want to manually test/use the app after running Dusk tests, you will need to rebuild the database `lando prep-db`

### Interactive Map

php artisan db:seed --class=MapItemsTableSeeder
storage/app/data/map_items.json
