<img height="100" src="./public/logo.png">

# Main Service

Main Service with Auth module built-in

## Requirement

-   Laravel 6
-   PHP 7.4.20 (or higher - Must delete `composer.lock` file)
-   MariaDB 10.4.\* | MySQL 5.7

## Docker Setup

1. Clone the Project:

2. Navigate to the Project Folder:  
   Use the `cd` command in your terminal to go to the project folder.

3. Install Dependencies:  
   Run the following command to install project dependencies:

    ```bash
    composer install --ignore-platform-reqs
    ```

4. Setup Environment Files:

    - Navigate to the `docker` folder and copy `.env.example` to `.env`:
        ```bash
        cp docker/.env.example docker/.env
        ```
    - Copy `.env.example` to `.env` in the project root folder:
        ```bash
        cp .env.example .env
        ```

5. Start Docker Containers:  
   Run this command to start the containers in detached mode:

    ```bash
    cd docker && docker compose up -d
    ```

6. Access the Application:  
   The application will run on the port specified by `HTTP_PORT` in the `.env` file located in the `docker` folder.

7. Fix Swagger Docs Issue (if needed):  
   If Swagger docs do not load at `api-docs`, run:
    ```bash
    cd docker && docker compose exec main sh && chmod 777 -R storage
    ```

## Other Commands

Note: First, connect to the `main` container by running:

```bash
docker compose exec main sh
```

-   Install Passport:

    ```bash
    php artisan passport:install
    ```

-   Seed Default Data:

    ```bash
    php artisan db:seed
    ```

-   Load Permissions:  
    Automatically loads permission data from controllers to the database.
    ```bash
    php artisan permission:autoload
    ```
-   Create Storage Symlink:  
    Run the following command to create a symbolic link for storage.
    ```bash
    php artisan storage:link
    ```

## Utils

-   Reload Permission List:
    Use this command to remove the existing permission list and reload it:
    ```bash
    php artisan permission:autoload --fresh
    ```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Maintainer

Teanis Backend Team

## License

© 2024 Teanis
