# ahg-hr-api AHG HR API # PHP Framework - Laravel 11.x.x ## Requirements - PHP version ≥ 8.2 - Git - Composer 2 - JWT-Auth - apache2 - Mysql (Version 8) - PhpMyAdmin Version 6 ## Usage To start the application, open the command prompt or terminal and run the following commands : ``` 1. Clone repository: `git clone https://gitlab.com/ahg-appdev/webdev/backend/ahg-hr-api.git` 2. Go to ahg-hr-api folder `cd ahg-hr-api` 3. Copy and rename the `.env.sample` to `.env` (Change the Database or any configuration, see below) 4. composer update 5. php artisan migrate 6. php artisan jwt:secret ``` To run the applications ``` php artisan serve ``` ## DATABASE CONFIGURATIONS DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 # LOCAL DB DB_DATABASE=ahg_hr DB_USERNAME=root DB_PASSWORD= # STAGING DB DB_DATABASE=autoph_ahg_hr_staging DB_USERNAME=autoph_admindb DB_PASSWORD=~cxk)gU^ziaB # PRODUCTION DB DB_DATABASE=autoph_ahg_hr DB_USERNAME=autoph_admindb DB_PASSWORD=~cxk)gU^ziaB ## Vhost Configuration Virtual host files are the files that specify the actual configuration of your virtual hosts and dictates how the Apache web server will respond to various domain requests. Apache comes with a default virtual host file called 000-default.conf. You can copy this file to create virtual host files for each of your domains. Copy the default configuration file over to the first domain: ``` sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/your_domain_1.conf ``` Be aware that the default Ubuntu configuration requires that each virtual host file end in .conf. Open the new file in your preferred text editor with root privileges: ``` sudo nano /etc/apache2/sites-available/your_domain_1.conf ``` With comments removed, the file will be similar to this: ``` ServerAdmin admin@your_domain_1 ServerName your_domain_1 ServerAlias www.your_domain_1 DocumentRoot /var/www/ahg-hr-api/public AllowOverride All ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ``` Within this file, customize the items for your first domain and add some additional directives. This virtual host section matches any requests that are made on port 80, the default HTTP port. ## Enabling the New Virtual Host Files ``` sudo a2ensite your_domain_1.conf ``` Next, test for configuration errors: ``` sudo apache2ctl configtest ``` The should receive the following output: ``` Output Syntax OK ``` When you are finished, restart Apache to make these changes take effect. ``` sudo systemctl restart apache2 ``` ## Restarting and Stop apache2 server Once the application starts, the service auto-restarts at server restart or server crash, unless explicitly told by the user. To stop the application, run the following code in the terminal': ``` sudo service apache2 stop ``` To restart the application, run the following code in the terminal': ``` sudo service apache2 restart ``` Note: Remove the 'sudo' command for Windows ## SAMPLE CREDENTIALS ROLE GROUP: Super Admin username : admin password : password ROLE GROUP: Admin username : demo password: password ## API URLS: # LOCAL http://127.0.0.1:8009 # STAGING https://staging-ahg-hr-api.autohub.ph # PRODUCTION https://ahg-hr-api.autohub.ph