# Insura

DOCUMENTATION

## About Insura

What is it?

Insura is a multi-insurance agency and client management system. It is written in Laravel, a strong PHP framework, and utilises the Semantic UI framework for smashing frontend views. Insura allows Insurance agencies to manage their staff, brokers, clients, communication, commissions and reminders all on one system. Managing an insurance Company couldn't be easier, We look deeper into the features later. Have fun :)

- Etiam posuere

## Requirements

Insura 2.x's requirements are simply a webserver running PHP >= 5.5.9 with the following extensions:-

- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension

## Installation

Installation is easy and will take less than 5 minutes. lets roll.

- STEP01

  ### Extract files

  Extract the zip file you downloaded from CodeCanyon in a directory where we will work from e.g. extract in /home/<user> to get /home/<user>/Insura-2.0.5 (Recommended for users on shared hosting with cPanel). This location should be away from your webserver's root directory.

- STEP02

  ### Database Setup

  Insura supports a range of databases (MySQL, PostgreSQL, SQLite3 and SQL). Depending on your choice of database, create a new database and new user and password for it where applicable. Remember to note down the database name and user and password where applicable as we will use this in step 4.
  NB: If you are using SQLite, copy the sqlite file to /home/<user>/Insura-2.0.5/Files/database/ and note down the filename instead e.g. insura.sqlite.

- STEP03

  ### Root Directory

  There are several ways to configure the root directory depending on your hosting setup.

  - If you can control your domain's document root, e.g when creating a sub-domain in your control panel, point it to /home/<user>/Insura-2.0.5/Files/public.

  - If your root directory is in your home folder, e.g. /home/<user>/public_html where public_html is the root directory, follow these steps:-
    >> Back up your current root directory by renaming it i.e. public_html to public_html.backup.
    >> From our working directory created in STEP 1, copy the file called root_dir in Utils to your home folder.
    >> Rename root_dir to public_html

  - If your root directory is not in your home folder (e.g. /var/www/html where html is the root directory) or you intend to add as a folder on he root directory (e.g. /var/www/html/insura where html is the root directory), follow these steps:-.
    >> Create a symbolic link to /home/<user>/Insura-2.0.5/Files/public
    >> Replace your document root with the link (To have something like http://www.example.com) or add it to your document root as a folder (To have something like http://www.example.com/insura) as preferred. Ensure you rename the copied link correctly for it to work.

- STEP04

  ### Web Setup

  Insura ships with a web installer accessible through your browser. After confirming that steps 1 - 3 were successfully completed, please navigate your browser to your domain e.g http://www.example.com or https://www.example.com/insura. A setup page will appear which guides you through the rest of the setup. Use the information we noted down in steps 1-3 to complete the forms. Ensure you key in the correct passwords where applicable.
  NB: Ensure the webserver has read and write access to the storage and bootstrap folders and everything in them which can be found in in the /home/<user>/Insura-2.0.5/Files directory. Also, if you have an SSL certificate for your domain, please use the https:// scheme to access the site e.g https://www.example.com to improve security.
  To make https a must when using apache, uncomment (Remove the preceding '#' character) lines #9 and #10 in the .htaccess file found in your new root directory created in Step 3 above like shown below:
  Change

      09    #RewriteCond %{HTTPS} !on
      10    #RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  to

      09    RewriteCond %{HTTPS} !on
      10    RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

- STEP05

  ### First Sign In

  If all went well and the setup was completed, CONGRATULATIONS! You should now be able to log in and use Insura. You could even ignore the rest of the steps... Just kidding! Move on to step 6.
  NB: If you encountered an error and re-tried steps 1 - 4 with no luck, skip to the manual installation section.

- STEP06

  ### Cron Jobs

  Insura uses cron jobs to automate reminders. You need to set a cron job that will do this on your server. Below is the sample cron job code. Modify the path to artisan to match your working folder, for our example this would be /home/<your username>/Insura-2.0.5/Files/artisan. When this is done, Insura is fully ready to use, but if you want more, there's more.

      * * * * * php <path to artisan> schedule:run >> /dev/null 2>&1

  Here is a great YouTube Video to help you with cron jobs if you are new.

- STEP07

  ### Supercharging Insura

  Insura uses laravel queues to send emails and texts in the background, therefore making your app faster. By basic installation the queue driver is set to sync which is slow, but if you want even more speed and true background execution, the database driver can be used. All you need is to change the queue driver and shell access to run a queue listener using these steps:-

  - >> In our working folder created in Step 01 (/home/<user>/Insura-2.0.5), navigate into Files. In there is a file named .env. If you cannot see it, ensure you have enabled viewing of hidden files in your file manager settings. This file stores all major settings of insura. Open this file and edit the line with
    `QUEUE_DRIVER=sync`
    to mathch the following:

        14 QUEUE_DRIVER=database

    Close and save the file

  - >> Then execute the following command in the Files directory to start the listener:
    `php artisan queue:work --daemon --queue default,emails,texts --tries 10 database >> /dev/null 2>&1 &`
    Here is an example of how that may go...

        user@example.com:~/Insura-2.0.5/Files$ php artisan queue:work --daemon --queue default,emails,texts --tries 10 database >> /dev/null 2>&1 &
        [1] 14638
        user@example.com:~/Insura-2.0.5/Files$ _

  That's pretty much it by now. Feel free to rate us on CodeCanyon as you enjoy the awesome powers of Insura. To add a language to or translate Insura, see Translating Insura. To update your installation of insura, see Update Insura.

## Manual Installation

Below are instructions on how to install.

- STEP05.01

  ### Database Setup

  In our working folder created in Step 01 (/home/<user>/Insura-2.0.5), there is a folder named Database which contains an SQL file named insura.sql. This file is the system's MySQL database. Import this file (/home/<user>/Insura-2.0.5/Database/insura.sql) using phpMyAdmin or whatever system you use. Watch this video if you are new to importing SQL databases. Remember to note down the database name and MySQL user and password as we will use this in step 4.

- STEP05.02

  ### Environment Setup

  In our working folder created in Step 01 (/home/<user>/Insura-2.0.5), navigate into Files/v2. In there is a file named .env. If you cannot see it, ensure you have enabled viewing of hidden files in your file manager settings. This file stores all major settings of insura. Open this file and edit these settings according to your setup. If you don't know how, refer to the .env.example file in the same directory. If you have no use for a setting (e.g. You can use either Amazon SES, Mailgun, Mandrill, SMTP or sendmail for email, one but not both), leave it empty as it can be changed later. Below are the values you will most likely want to change to:

      APP_ENV=production
      APP_DEBUG=false
      APP_URL=< e.g. https://www.example.com>
      DB_DATABASE=<your insura database name>
      DB_USERNAME=<your insura database username>
      DB_PASSWORD=<the insura database password>
      MAIL_USERNAME=<your mail login email>
      SMTP_HOST=< e.g. mail.example.com in case you use SMTP>
      SMTP_PASSWORD=<your mail login password in case you use SMTP>

  NB: Never change the APP_KEY value unless you understand what you're doing. Only the web installer can change this value safely.

- STEP05.03

  ### Finish

  At this point, it is safe to retry step 5, but no setup will be presented. You will be directed straight to the login page instead. Use the following credentials to log in:
  Email: demo@simcycreative.com
  Password: 123456

  Please continue with Step 6 above

## Translating

Adding a new Language to Insura? It's simple.

To add a new language to Insura, you may need some IT experience (not necessarily coding). Follow the steps indicated below:

- STEP08.01

  ### Create New Language Folder

  Create a new folder in /resources/lang/ in our working folder in Step 01. Name this folder an ISO version of the language you wish to translate to. I will use France's French language to demonstrate so I will name my folder fr_FR where fr is the two character code that represents the French language and FR is the two character code that represents the country France. The result is a folder /resources/lang/fr_FR/

- STEP08.02

  ### Copy Files for Translation

  Copy all files in the folder /resources/lang/en_US/ to our newly created folder /resources/lang/fr_FR/. You should have the following files in it:

      attachments.php
      auth.php
      brokers.php
      clients.php
      communication.php
      companies.php
      dashboard.php
      emails.php
      header.php
      inbox.php
      middleware.php
      notes.php
      pagination.php
      passwords.php
      payments.php
      policies.php
      products.php
      reports.php
      settings.php
      setup.php
      sidebar.php
      staff.php
      status.php
      users.php
      validation.php

- STEP08.03

  ### Translate the language files

  We will now do the actual language translations by editing the copied files. I will use an example to demonstrate how to go about this by translating the users.php file.
  Initially, the file looks like this:

       1<?php
       2
       3return [
       4
       5    /*
       6    |--------------------------------------------------------------------------
       7    | User Language Lines
       8    |--------------------------------------------------------------------------
       9    |
      10    | The following language lines are the default lines which match text used
      11    | with the User model on Insura.
      12    |
      13    */
      14
      15    'messages'      => [
      16        'error'     => [
      17            'missing'   => 'No such user was found!'
      18        ]
      19    ],
      20
      21];
      22

  We will translate the values after the => sign only. This will give the result below: NB: Do NOT translate words begining with a colon symbol i.e words like :name. These are used by Insura internaly and should be left as they are.

       1<?php
       2
       3return [
       4
       5    /*
       6    |--------------------------------------------------------------------------
       7    | User Language Lines
       8    |--------------------------------------------------------------------------
       9    |
      10    | The following language lines are the default lines which match text used
      11    | with the User model on Insura.
      12    |
      13    */
      14
      15    'messages'      => [
      16        'error'     => [
      17            'missing'   => 'Aucun utilisateur de ce type n'a été trouvé!'
      18        ]
      19    ],
      20
      21];
      22

- STEP08.04

  ### Add the new language to Insura's Configuration

  We will then add our new language to the /config/insura.php file at the languages section as shown below:

         1<?php

              ...

      1543    'languages'     => [
      1544        [
      1545            'identifiers'   => ['en_US.UTF-8', 'en.UTF-8', 'en-US', 'en'],
      1546            'locale'        => 'en_US',
      1547            'name'          => 'English (US)'
      1548        ],
      1549        [
      1550            'identifiers'   => ['fr_FR.UTF-8', 'fr.UTF-8', 'fr-FR', 'fr'],
      1551            'locale'        => 'fr_FR',
      1552            'name'          => 'French (FR)'
      1553        ]
      1554    ],

              ...

  Now the French language will be available in all pages where one can change languages (i.e. login and settings pages.

## Update Insura

Update Insura to a newer version.

- <=2.0.0

  ### For versions below 2.0.1 (2.0.0)

  If you currently run Insura version 2.0.0 follow these instructions:

  1. Extract the update files over your current installation.
  2. Delete the /bootstrap/cache/config.php file.
  3. Delete the /bootstrap/cache/routes.php file.
  4. Navigate to http(s)://<Your Installation URL>/update on your browser.

- >=2.0.1

  ### For versions above 2.0.0 (>=2.0.1)

  If you currently run Insura version 2.0.1 or greater follow these instructions:

  1. Extract the update files over your current installation.
  2. Navigate to http(s)://<Your Installation URL>/update on your browser.

- From 2.0.4 to 2.0.5

  ### For upgrading from version 2.0.4 to 2.0.5

  If you currently run Insura version 2.0.4 follow these instructions:

  1. Extract the distribution archive to a NEW location - do not overwrite your current installation.
  2. Copy the updated files over your current installation. Please refer to the release notes available from the Change Log for a list of files updated in the new version.

- NOTE

  Do NOT update insura using the above method if you do not want to loose any customization already done.

  Do NOT use a release archive for updating unless you intend to start afresh. Doing so will erase all your configurations and replace all files to default. ONLY use update archives.

## Support

We are always here to help.

Once again, thank you so much for purchasing this system. As I said at the beginning, I'd be glad to help you if you have any questions relating to this system. No guarantees, but I'll do my best to assist. If you have a more general question relating to the systems on CodeCanyon, you might consider visiting the forums and asking your question in the "Item Discussion" section.

- INFO

  ### Contact info

  Feel free to reach out if you have any questions, suggetions, customization requests or just saying Hi;
  Email: hello@simcycreative.com
  Support: Support

Insura 2.0.5 © Simcy Creative. All rights reserved. | Support Design by TEMPLATED.