initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
.git
|
||||
.gitignore
|
||||
.dockerignore
|
||||
.env
|
||||
.env.*
|
||||
*.md
|
||||
error_log
|
||||
.well-known
|
||||
node_modules
|
||||
vendor
|
||||
storage
|
||||
public_html
|
||||
@@ -0,0 +1,23 @@
|
||||
# App
|
||||
APP_URL=https://your-domain.com
|
||||
APP_KEY=
|
||||
|
||||
# Database
|
||||
DB_DATABASE=humicpro_aigo
|
||||
DB_USERNAME=humicpro_aigo
|
||||
DB_PASSWORD=changeme
|
||||
DB_ROOT_PASSWORD=rootpass
|
||||
|
||||
# Reverb (WebSocket)
|
||||
REVERB_APP_ID=103594
|
||||
REVERB_APP_KEY=zlno4t94kysjzmtwlmux
|
||||
REVERB_APP_SECRET=7zpl1vq4qvvotvrodq2u
|
||||
|
||||
# Vite build-time vars (used when rebuilding frontend)
|
||||
VITE_REVERB_HOST=your-domain.com
|
||||
VITE_REVERB_PORT=8080
|
||||
VITE_REVERB_SCHEME=https
|
||||
|
||||
# Strava (optional)
|
||||
STRAVA_CLIENT_ID=124405
|
||||
STRAVA_CLIENT_SECRET=
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
FROM composer:2.7 AS composer
|
||||
WORKDIR /app
|
||||
COPY aigo/ .
|
||||
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
FROM node:20-slim AS npm
|
||||
ARG VITE_REVERB_APP_KEY
|
||||
ARG VITE_REVERB_HOST
|
||||
ARG VITE_REVERB_PORT
|
||||
ARG VITE_REVERB_SCHEME
|
||||
ENV VITE_REVERB_APP_KEY=$VITE_REVERB_APP_KEY
|
||||
ENV VITE_REVERB_HOST=$VITE_REVERB_HOST
|
||||
ENV VITE_REVERB_PORT=$VITE_REVERB_PORT
|
||||
ENV VITE_REVERB_SCHEME=$VITE_REVERB_SCHEME
|
||||
WORKDIR /app
|
||||
COPY aigo/ .
|
||||
RUN npm ci && npm run build
|
||||
|
||||
FROM php:8.2-apache AS runtime
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libpq-dev libzip-dev libicu-dev libgd-dev libcurl4-openssl-dev unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN docker-php-ext-install pdo_mysql mbstring bcmath xml curl gd zip intl
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
RUN a2enmod rewrite
|
||||
|
||||
COPY --from=composer /app/vendor /var/www/aigo/vendor
|
||||
COPY --from=npm /app /var/www/aigo
|
||||
|
||||
RUN mkdir -p /var/www/aigo/storage/framework/{cache/sessions,cache/data,views,testing} \
|
||||
/var/www/aigo/storage/logs \
|
||||
/var/www/aigo/bootstrap/cache
|
||||
|
||||
COPY docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
||||
@@ -0,0 +1,94 @@
|
||||
# AIGO - Docker Deployment
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
aigo-docker/
|
||||
├── Dockerfile # 3-stage: composer → npm build → php:8.2-apache
|
||||
├── docker-compose.yml # 4 services: app, reverb, queue, db
|
||||
├── docker-entrypoint.sh # Waits for DB, runs migrate/cache/link
|
||||
├── .env.example # All required env vars
|
||||
├── .dockerignore
|
||||
├── docker/apache/
|
||||
│ └── 000-default.conf # DocumentRoot = /var/www/aigo/public
|
||||
├── aigo/ # Laravel source (git-tracked)
|
||||
│ ├── app/
|
||||
│ ├── config/
|
||||
│ ├── routes/
|
||||
│ ├── resources/ # Blade views, JS (echo.js), CSS
|
||||
│ ├── public/ # Static assets, build output
|
||||
│ ├── composer.json
|
||||
│ ├── package.json
|
||||
│ └── ...
|
||||
└── humicpro_aigo.sql # Database dump (auto-imported by MySQL)
|
||||
```
|
||||
|
||||
## Build Stages
|
||||
|
||||
| Stage | Image | Purpose |
|
||||
|-------|-------|---------|
|
||||
| `composer` | `composer:2.7` | `composer install --no-dev` |
|
||||
| `npm` | `node:20-slim` | `npm ci && npm run build` (compiles VITE_* vars into JS) |
|
||||
| `runtime` | `php:8.2-apache` | Apache + PHP with `mod_rewrite`, `pdo_mysql`, `redis` |
|
||||
|
||||
## Deploy to Coolify
|
||||
|
||||
1. Push this repo to GitHub/GitLab
|
||||
2. In Coolify, create a new project → select your repo
|
||||
3. Coolify auto-detects `docker-compose.yml`
|
||||
4. Set these **environment variables** in Coolify's UI:
|
||||
|
||||
### Required
|
||||
|
||||
| Variable | Description | How to get it |
|
||||
|----------|-------------|---------------|
|
||||
| `APP_URL` | Your domain | `https://your-domain.com` |
|
||||
| `APP_KEY` | Laravel encryption key | Run `php artisan key:generate --show` locally |
|
||||
| `DB_PASSWORD` | MySQL user password | Choose a secure password |
|
||||
| `DB_ROOT_PASSWORD` | MySQL root password | Choose a secure password |
|
||||
|
||||
### WebSocket (Reverb)
|
||||
|
||||
| Variable | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `VITE_REVERB_HOST` | Your Coolify domain | `your-domain.com` |
|
||||
| `VITE_REVERB_PORT` | WebSocket port | `8080` |
|
||||
| `VITE_REVERB_SCHEME` | `https` if Traefik handles TLS | `https` |
|
||||
|
||||
These VITE_* vars are build args — they get compiled into the JS bundle. To change them, update the env var in Coolify and rebuild.
|
||||
|
||||
### Optional
|
||||
|
||||
| Variable | Default |
|
||||
|----------|---------|
|
||||
| `STRAVA_CLIENT_ID` | `124405` |
|
||||
| `STRAVA_CLIENT_SECRET` | (leave blank if not used) |
|
||||
| `REVERB_APP_ID` | `103594` |
|
||||
| `REVERB_APP_KEY` | `zlno4t94kysjzmtwlmux` |
|
||||
| `REVERB_APP_SECRET` | `7zpl1vq4qvvotvrodq2u` |
|
||||
|
||||
5. In the **reverb** service settings, expose port **8080** via Traefik
|
||||
6. Deploy — MySQL auto-imports `humicpro_aigo.sql` on first startup
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Browser ──HTTPS──> Coolify/Traefik ──> app container (port 80 / Apache)
|
||||
Browser ──WSS──> Coolify/Traefik ──> reverb container (port 8080 / Reverb WebSocket)
|
||||
```
|
||||
|
||||
## Services
|
||||
|
||||
| Service | Image | Purpose |
|
||||
|---------|-------|---------|
|
||||
| `app` | Built from Dockerfile | Apache + PHP-FPM, serves the Laravel app |
|
||||
| `reverb` | Same image | Runs `php artisan reverb:start` for real-time WebSocket |
|
||||
| `queue` | Same image | Runs `php artisan queue:work` for background jobs |
|
||||
| `db` | `mysql:8.0` | MySQL database with auto-import of SQL dump |
|
||||
|
||||
## Maintenance
|
||||
|
||||
- **Storage**: Persistent volume `aigo-storage` at `/var/www/aigo/storage`
|
||||
- **Database**: Persistent volume `dbdata` at `/var/lib/mysql`
|
||||
- **Logs**: Available via `docker compose logs -f [service]`
|
||||
- **To change domain**: Update `APP_URL` + `VITE_REVERB_HOST` in Coolify, rebuild
|
||||
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
@@ -0,0 +1,72 @@
|
||||
APP_NAME=Aigo
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_TIMEZONE=UTC
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
APP_MAINTENANCE_STORE=database
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=aigo
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=pusher
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
STRAVA_CLIENT_ID=
|
||||
STRAVA_CLIENT_SECRET=
|
||||
STRAVA_REDIRECT_URI=
|
||||
@@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
name: Aigo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["unit-test"]
|
||||
pull_request:
|
||||
branches: ["unit-test"]
|
||||
|
||||
jobs:
|
||||
laravel-tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
|
||||
with:
|
||||
php-version: "8.2"
|
||||
- uses: actions/checkout@v3
|
||||
- name: Copy .env
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Install Dependencies
|
||||
run: composer install -q --no-ansi --ignore-platform-reqs --no-interaction --no-scripts --no-progress --prefer-dist
|
||||
- name: Generate key
|
||||
run: php artisan key:generate
|
||||
- name: Directory Permissions
|
||||
run: chmod -R 777 storage bootstrap/cache
|
||||
- name: Create Database
|
||||
run: |
|
||||
mkdir -p database
|
||||
touch database/database.sqlite
|
||||
- name: Execute tests (Unit and Feature tests) via PHPUnit
|
||||
env:
|
||||
DB_CONNECTION: sqlite
|
||||
DB_DATABASE: database/database.sqlite
|
||||
run: vendor/bin/phpunit
|
||||
@@ -0,0 +1,27 @@
|
||||
/vendor/
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# Laravel 4 specific
|
||||
bootstrap/compiled.php
|
||||
app/storage/
|
||||
|
||||
# Laravel 5 & Lumen specific
|
||||
public/storage
|
||||
public/hot
|
||||
|
||||
# Laravel 5 & Lumen specific with changed public path
|
||||
public_html/storage
|
||||
public_html/hot
|
||||
|
||||
public/build/
|
||||
storage/*.key
|
||||
.env
|
||||
.env.production
|
||||
.env.*.local
|
||||
Homestead.yaml
|
||||
Homestead.json
|
||||
/.vagrant
|
||||
.phpunit.result.cache
|
||||
bootstrap/cache/*.php
|
||||
@@ -0,0 +1,19 @@
|
||||
## Our Responsibilities
|
||||
|
||||
To provide you with the most personalized experience possible, AIGO offers features that connect with your [**Strava account**](https://support.strava.com/hc/en-us/articles/360018969732-App-Authorization-Settings). We understand data privacy is important, and we want to assure you that your information is secure.
|
||||
|
||||
- By authorizing your [**Strava account**](https://support.strava.com/hc/en-us/articles/360018969732-App-Authorization-Settings), you're enabling us to provide you a personalized experience while ensuring the security and protection of your data.
|
||||
- We only access data relevant to your AIGO experience.
|
||||
- We're committed to transparency in how we handle your data, and we will never misuse or share it without your explicit consent.
|
||||
|
||||
Your trust is paramount to us, and we're dedicated to upholding the highest standards of data privacy and security in everything we do.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
@@ -0,0 +1,22 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer)
|
||||
Copyright (c) 2017-2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,76 @@
|
||||
<p align="center"><a href="https://aigo.flxnzz.my.id" target="_blank"><img src="public/asset/png/logo.svg" width=500 alt="AIGO Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
<h3 align="center">
|
||||
<a href="#overview">Overview</a> •
|
||||
<a href="#features">Features</a> •
|
||||
<a href="#getting-started">Getting Started</a> •
|
||||
<a href="#requirements">Requirements</a> •
|
||||
<a href="#contributors">Contributors</a> •
|
||||
<a href="#license">License</a>
|
||||
</h3>
|
||||
|
||||
## Overview
|
||||
|
||||

|
||||
|
||||
AIGO is an AI-powered guidance system designed to assist in the management of obesity. This innovative platform leverages the power of Internet of Things (IoT) devices, specifically smartwatches, to gain valuable insights into your daily activities. Aigo provides personalized recommendations for weight management, nutrition, and exercise.
|
||||
|
||||
## Features
|
||||
|
||||
Our platform offers a comprehensive suite of features designed to manage healthy lifestyle habits and effective weight management:
|
||||
|
||||
- **Real-time Progress Monitoring:** Visualize your activity progress in real-time through intuitive dashboards and charts.
|
||||
|
||||
- **IoT-Powered Health Tracking**: Monitor your daily activity, such as steps taken, distance traveled, and calories burned.
|
||||
|
||||
- **Personalized Health Recommendation**: AIGO utilizes IoT devices (smartwatch) to monitor various lifestyle such as physical activity, eating habits, and sleep patterns. Users can receive recommendations by consulting a doctor by utilizing those data.
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Internet Connection.** A stable internet connection is required to access our web platform and interact with our services seamlessly.
|
||||
- **IoT Devices.** The types of IoT devices supported for monitoring physical activity are smartwatches and smartbands, such as Apple Watch, Mi Band, Amazfit, etc. _(Tested on Amazfit GTS 2e)_
|
||||
- **Strava Account.** To access our services, you'll need a Strava account for [authentication and authorization purposes](#data-privacy-and-security).
|
||||
|
||||
## Getting Started
|
||||
|
||||
To set up and utilize our platform, follow these steps:
|
||||
|
||||
- Register an account and provide basic personal information.
|
||||
- In order to use our services, you need to [Authorize Strava Account](https://support.strava.com/hc/en-us/articles/360018969732-App-Authorization-Settings)
|
||||
|
||||
- Connect your IoT devices (smartwatch) to AIGO to start tracking key lifestyle metrics.
|
||||
|
||||
- Track and Monitor your progress and visualize trends over time.
|
||||
|
||||
- Access personalized recommendations based on your health data and activity progress
|
||||
|
||||
## Contributors
|
||||
|
||||
We appreciate the dedication and contributions of the following individuals to this project:
|
||||
|
||||
| Name | Role | GitHub |
|
||||
| ---------------------------- | -------------------------------------- | --------------------------------------------------------- |
|
||||
| Rafidhia Haikal Pasya | Full-stack Developer & DevOps Engineer | [@W-zrd](https://github.com/W-zrd/) |
|
||||
| Putu Vidya Ananda Ratmayanti | UI Designer & Front-end Developer | [@vidyaratmayantii](https://github.com/vidyaratmayantii/) |
|
||||
| Muhammad Vikhan Muharram | AI Developer | [@vikhanmuhammad](https://github.com/vikhanmuhammad/) |
|
||||
| Mohammad William | UI Designer | [@Vanillateaa](https://github.com/Vanillateaa/) |
|
||||
|
||||
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- AIGO was developed to address the growing need for personalized health management solutions.
|
||||
- Special thanks to all contributors and open-source libraries used in the development of AIGO.
|
||||
|
||||
---
|
||||
|
||||
> Aigo [aigo.w333zard.my.id](http://aigo.w333zard.my.id/) ·
|
||||
> GitHub [@W-zrd](https://github.com/W-zrd) ·
|
||||
> Medium [@w333zard](https://medium.com/@flxnzz_47)
|
||||
@@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
If you discover a security issue, please bring it to our attention right away!
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please **DO NOT** file a public issue to report a security vulberability, instead send your report privately to **rfdhaikal.wizz@proton.me**. This will help ensure that any vulnerabilities that are found can be [disclosed responsibly](https://en.wikipedia.org/wiki/Responsible_disclosure) to any affected parties.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Project versions that are currently being supported with security updates vary per project.
|
||||
Please see specific project repositories for details.
|
||||
If nothing is specified, only the latest major versions are supported.
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use App\Models\HealthData;
|
||||
use DB;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function dashboard(Request $request)
|
||||
{
|
||||
$userRoleCounts = User::groupBy('user_role')
|
||||
->select('user_role', DB::raw('count(*) as count'))
|
||||
->get();
|
||||
|
||||
$doctorCount = User::where('user_role', 'doctor')->count();
|
||||
$patientCount = User::where('user_role', 'user')->count();
|
||||
$maleCount = User::where('user_role', 'user')->where('gender', 'Male')->count();
|
||||
$femaleCount = User::where('user_role', 'user')->where('gender', 'Female')->count();
|
||||
|
||||
$normalCount = HealthData::where('obesity_status', 'Normal')->count();
|
||||
$obesityCount = HealthData::where('obesity_status', 'Obesity')->count();
|
||||
|
||||
return view('dashboardAdmin',
|
||||
compact('userRoleCounts', 'doctorCount', 'patientCount', 'maleCount', 'femaleCount', 'normalCount', 'obesityCount'));
|
||||
}
|
||||
|
||||
public function showDoctor(Request $request){
|
||||
return view('doctor-list', ["data" => User::where('user_role', 'doctor')->get()]);
|
||||
}
|
||||
|
||||
public function showPatient(Request $request)
|
||||
{
|
||||
$data = User::where('user_role', 'user')->get();
|
||||
return view('patient-list')->with('data', $data);
|
||||
}
|
||||
|
||||
public function showUserDetail($id){
|
||||
$data = User::find($id);
|
||||
return view('update-user', compact('data'));
|
||||
}
|
||||
|
||||
public function updateData(Request $request, $id){
|
||||
$data = User::find($id);
|
||||
$data -> update($request -> all());
|
||||
return redirect()->route('showPatient');
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$data = User::find($id);
|
||||
$data -> delete();
|
||||
return redirect()->route('showPatient');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\HealthData;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HealthDataAPIController extends Controller
|
||||
{
|
||||
public function getHealthData($userId)
|
||||
{
|
||||
$healthData = HealthData::where('users_id', $userId)->first();
|
||||
|
||||
if (!$healthData) {
|
||||
return response()->json(['error' => 'Health data not found'], 404);
|
||||
}
|
||||
|
||||
return response()->json($healthData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserAPIController extends Controller
|
||||
{
|
||||
public function getUser($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
|
||||
if (!$user) {
|
||||
return response()->json(['error' => 'User not found'], 404);
|
||||
}
|
||||
|
||||
return response()->json($user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Auth\LoginRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
use App\Models\User;
|
||||
|
||||
class AuthenticatedSessionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the login view.
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming authentication request.
|
||||
*/
|
||||
public function store(LoginRequest $request): RedirectResponse
|
||||
{
|
||||
$request->authenticate();
|
||||
$request->session()->regenerate();
|
||||
|
||||
$role = Auth::user()->user_role;
|
||||
|
||||
if ($role == 'user') {
|
||||
return redirect()->intended(route('dashboard'));
|
||||
} else if ($role == 'doctor') {
|
||||
// return redirect()->intended(route('doctor.dashboard'));
|
||||
} else {
|
||||
return redirect()->intended(route('admin.dashboard'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an authenticated session.
|
||||
*/
|
||||
public function destroy(Request $request): RedirectResponse
|
||||
{
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
if ($request->session()->has('remember_token')) {
|
||||
$request->session()->forget('remember_token');
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ConfirmablePasswordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the confirm password view.
|
||||
*/
|
||||
public function show(): View
|
||||
{
|
||||
return view('auth.confirm-password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm the user's password.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
if (! Auth::guard('web')->validate([
|
||||
'email' => $request->user()->email,
|
||||
'password' => $request->password,
|
||||
])) {
|
||||
throw ValidationException::withMessages([
|
||||
'password' => __('auth.password'),
|
||||
]);
|
||||
}
|
||||
|
||||
$request->session()->put('auth.password_confirmed_at', time());
|
||||
|
||||
return redirect()->intended(route('dashboard', absolute: false));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmailVerificationNotificationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Send a new email verification notification.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return redirect()->intended(route('dashboard', absolute: false));
|
||||
}
|
||||
|
||||
$request->user()->sendEmailVerificationNotification();
|
||||
|
||||
return back()->with('status', 'verification-link-sent');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class EmailVerificationPromptController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the email verification prompt.
|
||||
*/
|
||||
public function __invoke(Request $request): RedirectResponse|View
|
||||
{
|
||||
return $request->user()->hasVerifiedEmail()
|
||||
? redirect()->intended(route('dashboard', absolute: false))
|
||||
: view('auth.verify-email');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rules;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class NewPasswordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the password reset view.
|
||||
*/
|
||||
public function create(Request $request): View
|
||||
{
|
||||
return view('auth.reset-password', ['request' => $request]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming new password request.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validate([
|
||||
'token' => ['required'],
|
||||
'email' => ['required', 'email'],
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
]);
|
||||
|
||||
// Here we will attempt to reset the user's password. If it is successful we
|
||||
// will update the password on an actual user model and persist it to the
|
||||
// database. Otherwise we will parse the error and return the response.
|
||||
$status = Password::reset(
|
||||
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||
function ($user) use ($request) {
|
||||
$user->forceFill([
|
||||
'password' => Hash::make($request->password),
|
||||
'remember_token' => Str::random(60),
|
||||
])->save();
|
||||
|
||||
event(new PasswordReset($user));
|
||||
}
|
||||
);
|
||||
|
||||
// If the password was successfully reset, we will redirect the user back to
|
||||
// the application's home authenticated view. If there is an error we can
|
||||
// redirect them back to where they came from with their error message.
|
||||
return $status == Password::PASSWORD_RESET
|
||||
? redirect()->route('login')->with('status', __($status))
|
||||
: back()->withInput($request->only('email'))
|
||||
->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
|
||||
class PasswordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Update the user's password.
|
||||
*/
|
||||
public function update(Request $request): RedirectResponse
|
||||
{
|
||||
$validated = $request->validateWithBag('updatePassword', [
|
||||
'current_password' => ['required', 'current_password'],
|
||||
'password' => ['required', Password::defaults(), 'confirmed'],
|
||||
]);
|
||||
|
||||
$request->user()->update([
|
||||
'password' => Hash::make($validated['password']),
|
||||
]);
|
||||
|
||||
return back()->with('status', 'password-updated');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PasswordResetLinkController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the password reset link request view.
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('auth.forgot-password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming password reset link request.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validate([
|
||||
'email' => ['required', 'email'],
|
||||
]);
|
||||
|
||||
// We will send the password reset link to this user. Once we have attempted
|
||||
// to send the link, we will examine the response then see the message we
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
$status = Password::sendResetLink(
|
||||
$request->only('email')
|
||||
);
|
||||
|
||||
return $status == Password::RESET_LINK_SENT
|
||||
? back()->with('status', __($status))
|
||||
: back()->withInput($request->only('email'))
|
||||
->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Rules;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class RegisteredUserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the registration view.
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming registration request.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validate([
|
||||
'username' => 'required|string|unique:users',
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
|
||||
'telepon' => 'required|string',
|
||||
'alamat' => 'string',
|
||||
'gender' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'user_role' => 'user',
|
||||
'username' => $request->username,
|
||||
'password' => bcrypt($request->password),
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'telepon' => $request->telepon,
|
||||
'alamat' => $request->alamat,
|
||||
'gender' => $request->gender,
|
||||
]);
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
//Auth::login($user);
|
||||
|
||||
return redirect(route('login', absolute: false));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class VerifyEmailController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mark the authenticated user's email address as verified.
|
||||
*/
|
||||
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||
{
|
||||
if ($request->user()->hasVerifiedEmail()) {
|
||||
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||
}
|
||||
|
||||
if ($request->user()->markEmailAsVerified()) {
|
||||
event(new Verified($request->user()));
|
||||
}
|
||||
|
||||
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\HealthData;
|
||||
use App\Models\User;
|
||||
use App\Models\Consultation;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ConsultationController extends Controller
|
||||
{
|
||||
public function showHealthDataForm()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$healthData = HealthData::where('users_id', $user->id)->get()->last();
|
||||
return view('health-data', compact('healthData'));
|
||||
}
|
||||
|
||||
public function storeHealthDataForm(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'birthdate' => 'required|date',
|
||||
'weight' => 'required|numeric',
|
||||
'height' => 'required|numeric',
|
||||
'sleeptime' => 'required|integer',
|
||||
'disease' => 'required|string',
|
||||
'food' => 'required|string',
|
||||
'alergi_makanan' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = auth()->user();
|
||||
|
||||
$data = HealthData::create(
|
||||
[
|
||||
'users_id' => $user->id,
|
||||
'birthdate' => Carbon::parse($validatedData['birthdate'])->format('Y-m-d'),
|
||||
'weight' => $validatedData['weight'],
|
||||
'height' => $validatedData['height'],
|
||||
'sleeptime' => $validatedData['sleeptime'],
|
||||
'disease' => $validatedData['disease'],
|
||||
'food' => $validatedData['food'],
|
||||
'alergi_makanan' => $validatedData['alergi_makanan'],
|
||||
]
|
||||
);
|
||||
|
||||
return redirect()->route('jadwal.show');
|
||||
}
|
||||
|
||||
|
||||
public function showJadwalForm()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$doctors = User::where('user_role', 'doctor')->get();
|
||||
return view('jadwal-konsultasi', compact('doctors'));
|
||||
}
|
||||
|
||||
// ConsultationController.php
|
||||
public function storeConsultation(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'doctor_id' => 'required|exists:users,id',
|
||||
'consultation_date' => 'required|date',
|
||||
'consultation_time' => 'required',
|
||||
'location' => 'required|string',
|
||||
]);
|
||||
|
||||
$user = auth()->user();
|
||||
|
||||
$data = Consultation::create([
|
||||
'patient_id' => $user->id,
|
||||
'doctor_id' => $validatedData['doctor_id'],
|
||||
'consultation_date' => Carbon::parse($validatedData['consultation_date'])->format('Y-m-d'),
|
||||
'consultation_time' => $validatedData['consultation_time'],
|
||||
'location' => $validatedData['location'],
|
||||
'consultation_status' => 'pending',
|
||||
]);
|
||||
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\StravaController;
|
||||
use App\Http\Controllers\ConsultationController;
|
||||
use App\Models\PhysicalActivity;
|
||||
use App\Models\HealthData;
|
||||
use App\Models\Result;
|
||||
use App\Models\Notification;
|
||||
use App\Models\Consultation;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
|
||||
public function dashboardClient()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$activities = PhysicalActivity::where('users_id', $user->id)->get();
|
||||
$healthData = HealthData::where('users_id', $user->id)->get()->last();
|
||||
|
||||
$activities->transform(function ($activity) {
|
||||
$activity->date = Carbon::parse($activity->date)->format('d M Y');
|
||||
$activity->calories_burned = $activity->calculateCaloriesBurned();
|
||||
return $activity;
|
||||
});
|
||||
|
||||
// Loop through activities and print out the values
|
||||
|
||||
$totalDistance = $activities->sum('distance');
|
||||
|
||||
if ($healthData) {
|
||||
// Check if obesity_status is null
|
||||
if (!$healthData->obesity_status) {
|
||||
// Call prediction method only if obesity_status is null
|
||||
$obesityPrediction = $this->predictObesity($healthData, $user);
|
||||
$healthData->obesity_status = $obesityPrediction;
|
||||
$healthData->save();
|
||||
}
|
||||
|
||||
// Check if calorie_recommendation is null
|
||||
if (!$healthData->calorie_recommendation) {
|
||||
// Call calorie prediction method only if calorie_recommendation is null
|
||||
$calorieRecommendation = $this->predictCalories($healthData, $user);
|
||||
$healthData->calorie_recommendation = $calorieRecommendation;
|
||||
$healthData->save();
|
||||
}
|
||||
}
|
||||
|
||||
return view('dashboardClient', compact('activities', 'healthData', 'totalDistance'));
|
||||
}
|
||||
|
||||
private function predictObesity($healthData, $user)
|
||||
{
|
||||
$data = [
|
||||
'height' => $healthData->height ?? 0,
|
||||
'weight' => $healthData->weight ?? 0,
|
||||
'age' => now()->diffInYears($healthData->birthdate ?? '2000-03-25'),
|
||||
'gender' => ($user->gender === 'male') ? 'M' : 'F',
|
||||
'activity_level' => 1,
|
||||
];
|
||||
|
||||
$obesityPrediction = Http::post('https://aigoo.humicprototypingapi.online/api/predict/obesity', $data)->json();
|
||||
$predictedCategory = $obesityPrediction['predicted_category'] ?? null;
|
||||
return $predictedCategory;
|
||||
}
|
||||
|
||||
private function predictCalories($healthData, $user)
|
||||
{
|
||||
$data = [
|
||||
'height' => $healthData->height ?? 0,
|
||||
'weight' => $healthData->weight ?? 0,
|
||||
'age' => now()->diffInYears($healthData->birthdate ?? '2000-03-25'),
|
||||
'gender' => ($user->gender === 'male') ? 'M' : 'F',
|
||||
];
|
||||
|
||||
$response = Http::post('https://aigoo.humicprototypingapi.online/api/predict/calorie', $data);
|
||||
$predictedCalories = ceil($response->json()['predicted_calories']);
|
||||
|
||||
return $predictedCalories;
|
||||
}
|
||||
|
||||
public function activityReport()
|
||||
{
|
||||
$currentMonth = now()->format('m');
|
||||
$currentYear = now()->format('Y');
|
||||
|
||||
$user = auth()->user();
|
||||
$healthData = HealthData::where('users_id', $user->id)
|
||||
->orderBy('updated_at', 'desc')
|
||||
->get();
|
||||
|
||||
$healthData->transform(function ($item) {
|
||||
$item->formatted_created_at = Carbon::parse($item->created_at)->format('d F Y');
|
||||
$item->time = Carbon::parse($item->created_at)->format('h:i A');
|
||||
return $item;
|
||||
});
|
||||
|
||||
$activities = PhysicalActivity::whereYear('date', $currentYear)
|
||||
->whereMonth('date', $currentMonth)
|
||||
->where('users_id', $user->id)
|
||||
->get();
|
||||
|
||||
$totalSteps = $activities->sum('avg_steps');
|
||||
$totalDistance = $activities->sum('distance');
|
||||
$totalDuration = $activities->sum('duration');
|
||||
|
||||
if ($totalDuration < 60) {
|
||||
$durationValue = $totalDuration;
|
||||
$durationUnit = 'seconds';
|
||||
} elseif ($totalDuration < 3600) {
|
||||
$durationValue = floor($totalDuration / 60);
|
||||
$durationUnit = 'minutes';
|
||||
} else {
|
||||
$durationValue = floor($totalDuration / 3600);
|
||||
$durationUnit = 'hours';
|
||||
}
|
||||
|
||||
$filteredHealthData = collect();
|
||||
foreach ($healthData as $index => $data) {
|
||||
if ($index < $healthData->count() - 1) {
|
||||
$nextWeight = $healthData[$index + 1]->weight;
|
||||
$data->weight_difference = $data->weight - $nextWeight;
|
||||
if ($data->weight_difference != 0) {
|
||||
$filteredHealthData->push($data);
|
||||
}
|
||||
} else {
|
||||
$data->weight_difference = 0;
|
||||
$filteredHealthData->push($data);
|
||||
}
|
||||
}
|
||||
|
||||
$totalSleepTime = $healthData->sum('sleeptime');
|
||||
if ($healthData->count() > 0) {
|
||||
$averageSleepTime = number_format($totalSleepTime / $healthData->count(), 2);
|
||||
} else {
|
||||
$averageSleepTime = 0;
|
||||
}
|
||||
|
||||
$latestHealthData = $healthData->last();
|
||||
if ($latestHealthData) {
|
||||
$predictedCalories = $this->predictCalories($latestHealthData, $user);
|
||||
} else {
|
||||
$predictedCalories = 0;
|
||||
}
|
||||
|
||||
$recommended_distance = Result::where('patient_id', $user->id)->get()->last()->jarak_lari ?? 0;
|
||||
|
||||
|
||||
$chartData = PhysicalActivity::whereYear('date', $currentYear)
|
||||
->whereMonth('date', $currentMonth)
|
||||
->where('users_id', $user->id)
|
||||
->orderBy('date')
|
||||
->get();
|
||||
|
||||
$labels = $chartData->map(function ($activity) {
|
||||
return Carbon::parse($activity->date)->format('d F');
|
||||
});
|
||||
|
||||
$distances = $chartData->map(function ($activity) {
|
||||
return intval($activity->distance);
|
||||
});
|
||||
|
||||
$durations = $chartData->map(function ($activity) {
|
||||
return intval($activity->duration);
|
||||
});
|
||||
|
||||
return view('activity-report', compact(
|
||||
'totalSteps', 'totalDistance', 'durationValue', 'durationUnit',
|
||||
'averageSleepTime', 'filteredHealthData', 'activities', 'predictedCalories',
|
||||
'recommended_distance', 'labels', 'distances', 'durations'
|
||||
));
|
||||
}
|
||||
|
||||
public function schedule()
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$approvedConsultations = Consultation::where('patient_id', $user->id)
|
||||
->where('consultation_status', 'approved')
|
||||
->with('doctor')
|
||||
->get();
|
||||
|
||||
return view('customer-schedule', compact('approvedConsultations'));
|
||||
}
|
||||
|
||||
public function notifications()
|
||||
{
|
||||
$patient = auth()->user();
|
||||
$notifications = Notification::where('user_id', $patient->id)->orderBy('created_at', 'desc')->get();
|
||||
|
||||
return view('patient-notifications', compact('notifications'));
|
||||
}
|
||||
|
||||
public function consultation()
|
||||
{
|
||||
return view('health-data');
|
||||
}
|
||||
|
||||
|
||||
public function consultationResults()
|
||||
{
|
||||
$patient = auth()->user();
|
||||
$consultations = Consultation::where('patient_id', $patient->id)
|
||||
->where('consultation_status', 'finished')
|
||||
->with('doctor', 'result')
|
||||
->orderBy('consultation_date', 'desc')
|
||||
->get();
|
||||
|
||||
return view('customer-result', compact('consultations'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Consultation;
|
||||
use App\Models\Result;
|
||||
use App\Models\User;
|
||||
use App\Models\HealthData;
|
||||
use App\Models\Notification;
|
||||
|
||||
class DoctorController extends Controller
|
||||
{
|
||||
public function dashboard()
|
||||
{
|
||||
$normalWeightCount = HealthData::where('obesity_status', 'Normal weight')->count();
|
||||
$overweightCount = HealthData::where('obesity_status', 'Overweight')->count();
|
||||
$unknownCount = HealthData::whereNotIn('obesity_status', ['Normal weight', 'Overweight'])->count();
|
||||
|
||||
$doctor = auth()->user();
|
||||
|
||||
$totalAppointments = Consultation::where('doctor_id', $doctor->id)->count();
|
||||
$pendingAppointments = Consultation::where('doctor_id', $doctor->id)
|
||||
->where('consultation_status', 'pending')
|
||||
->count();
|
||||
|
||||
$malePatients = User::where('user_role', 'user')
|
||||
->where('gender', 'male')
|
||||
->count();
|
||||
$femalePatients = User::where('user_role', 'user')
|
||||
->where('gender', 'female')
|
||||
->count();
|
||||
|
||||
|
||||
$latestAppointments = Consultation::where('doctor_id', $doctor->id)
|
||||
->orderBy('consultation_date', 'desc')
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
return view('dashboardDoctor', compact(
|
||||
'normalWeightCount',
|
||||
'overweightCount',
|
||||
'unknownCount',
|
||||
'totalAppointments',
|
||||
'pendingAppointments',
|
||||
'malePatients',
|
||||
'femalePatients',
|
||||
'latestAppointments'
|
||||
));
|
||||
}
|
||||
|
||||
public function notifications()
|
||||
{
|
||||
$doctor = auth()->user();
|
||||
$notifications = Notification::where('user_id', $doctor->id)->orderBy('created_at', 'desc')->get();
|
||||
|
||||
return view('doctor-notifications', compact('notifications'));
|
||||
}
|
||||
|
||||
public function patientAcceptance()
|
||||
{
|
||||
$doctor = auth()->user();
|
||||
$consultations = Consultation::with('patient')
|
||||
->where('doctor_id', $doctor->id)
|
||||
->where('consultation_status', 'pending')
|
||||
->get();
|
||||
|
||||
return view('acceptance-patients', compact('consultations'));
|
||||
}
|
||||
|
||||
public function approveConsultation($consultationId)
|
||||
{
|
||||
$consultation = Consultation::findOrFail($consultationId);
|
||||
$consultation->consultation_status = 'approved';
|
||||
$consultation->save();
|
||||
|
||||
// Create notification for the patient
|
||||
$patientNotification = new Notification();
|
||||
$patientNotification->user_id = $consultation->patient_id;
|
||||
$patientNotification->consultation_id = $consultation->id;
|
||||
$patientNotification->message = 'Your consultation request has been approved by Dr. ' . $consultation->doctor->name . '.';
|
||||
$patientNotification->save();
|
||||
|
||||
// Create notification for the doctor
|
||||
$doctorNotification = new Notification();
|
||||
$doctorNotification->user_id = $consultation->doctor_id;
|
||||
$doctorNotification->consultation_id = $consultation->id;
|
||||
$doctorNotification->message = 'You have approved the consultation request from ' . $consultation->patient->name . '.';
|
||||
$doctorNotification->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Consultation approved successfully.');
|
||||
}
|
||||
|
||||
public function declineConsultation($consultationId)
|
||||
{
|
||||
$consultation = Consultation::findOrFail($consultationId);
|
||||
$consultation->consultation_status = 'declined';
|
||||
$consultation->save();
|
||||
|
||||
// Create notification for the patient
|
||||
$patientNotification = new Notification();
|
||||
$patientNotification->user_id = $consultation->patient_id;
|
||||
$patientNotification->consultation_id = $consultation->id;
|
||||
$patientNotification->message = 'Your consultation request has been declined by Dr. ' . $consultation->doctor->name . '.';
|
||||
$patientNotification->save();
|
||||
|
||||
// Create notification for the doctor
|
||||
$doctorNotification = new Notification();
|
||||
$doctorNotification->user_id = $consultation->doctor_id;
|
||||
$doctorNotification->consultation_id = $consultation->id;
|
||||
$doctorNotification->message = 'You have declined the consultation request from ' . $consultation->patient->name . '.';
|
||||
$doctorNotification->save();
|
||||
|
||||
return redirect()->back()->with('success', 'Consultation declined successfully.');
|
||||
}
|
||||
|
||||
public function schedule()
|
||||
{
|
||||
$doctor = auth()->user();
|
||||
$approvedConsultations = Consultation::where('doctor_id', $doctor->id)
|
||||
->where('consultation_status', 'approved')
|
||||
->with('patient.healthDatas')
|
||||
->get();
|
||||
|
||||
return view('doctor-schedule', compact('approvedConsultations'));
|
||||
}
|
||||
|
||||
public function showConsultationResultForm($patientId)
|
||||
{
|
||||
return view('doctor-result-form', compact('patientId'));
|
||||
}
|
||||
|
||||
public function storeConsultationResult(Request $request)
|
||||
{
|
||||
$validatedData = $request->validate([
|
||||
'doctor_id' => 'required|exists:users,id',
|
||||
'patient_id' => 'required|exists:users,id',
|
||||
'jarak_lari' => 'required|integer',
|
||||
'sleeptime' => 'required|numeric',
|
||||
'food' => 'required|string',
|
||||
'unrecommended_food' => 'required|string',
|
||||
'notes' => 'required|string',
|
||||
]);
|
||||
|
||||
$consultation = Consultation::where('doctor_id', $validatedData['doctor_id'])
|
||||
->where('patient_id', $validatedData['patient_id'])
|
||||
->where('consultation_status', 'approved')
|
||||
->first();
|
||||
|
||||
if ($consultation) {
|
||||
$validatedData['consultation_id'] = $consultation->id;
|
||||
Result::create($validatedData);
|
||||
|
||||
$consultation->consultation_status = 'finished';
|
||||
$consultation->save();
|
||||
|
||||
return redirect()->route('doctor.schedule')->with('success', 'Consultation result submitted successfully.');
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', 'Consultation not found or already finished.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ProfileUpdateRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the user's profile form.
|
||||
*/
|
||||
public function edit(Request $request): View
|
||||
{
|
||||
return view('profile.edit', [
|
||||
'user' => $request->user(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the user's profile information.
|
||||
*/
|
||||
public function update(ProfileUpdateRequest $request): RedirectResponse
|
||||
{
|
||||
$request->user()->fill($request->validated());
|
||||
|
||||
if ($request->user()->isDirty('email')) {
|
||||
$request->user()->email_verified_at = null;
|
||||
}
|
||||
|
||||
$request->user()->save();
|
||||
|
||||
return Redirect::route('profile.edit')->with('status', 'profile-updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the user's account.
|
||||
*/
|
||||
public function destroy(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validateWithBag('userDeletion', [
|
||||
'password' => ['required', 'current_password'],
|
||||
]);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
Auth::logout();
|
||||
|
||||
$user->delete();
|
||||
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return Redirect::to('/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\PhysicalActivity;
|
||||
|
||||
|
||||
class StravaController extends Controller
|
||||
{
|
||||
|
||||
public function authorize(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
if (Auth::attempt($request->only('email', 'password'), $request->filled('remember'))) {
|
||||
if (Auth::user()->user_role == 'user') {
|
||||
$clientId = "124405";
|
||||
$redirectUri = route('strava.callback');
|
||||
$authUrl = "https://www.strava.com/oauth/authorize?client_id={$clientId}&redirect_uri={$redirectUri}&response_type=code&scope=activity:read_all";
|
||||
|
||||
return redirect()->away($authUrl);
|
||||
} elseif (Auth::user()->user_role == 'doctor') {
|
||||
return redirect()->route('doctor.dashboard');
|
||||
} else {
|
||||
return redirect()->route('admin.dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'email' => 'The provided credentials do not match our records.',
|
||||
]);
|
||||
}
|
||||
|
||||
public function handleCallback(Request $request)
|
||||
{
|
||||
$authorizationCode = $request->input('code');
|
||||
if ($authorizationCode) {
|
||||
$tokenEndpoint = "https://www.strava.com/oauth/token";
|
||||
$clientId = "124405";
|
||||
$clientSecret = "2df5d622c326215c290841fb0ffcdd894274803e";
|
||||
|
||||
$response = Http::post($tokenEndpoint, [
|
||||
'client_id' => $clientId,
|
||||
'client_secret' => $clientSecret,
|
||||
'code' => $authorizationCode,
|
||||
'grant_type' => 'authorization_code',
|
||||
]);
|
||||
|
||||
$data = $response->json();
|
||||
//dd($data);
|
||||
$accessToken = $data['access_token'];
|
||||
|
||||
|
||||
// Store the access token in the session or database for future API requests
|
||||
session(['strava_access_token' => $accessToken]);
|
||||
// Redirect the user to the desired page after successful authorization
|
||||
|
||||
if (auth()->user()->user_role == 'user') {
|
||||
$this->fetchAthleteActivities($data['access_token']);
|
||||
return redirect()->intended(route('dashboard'));
|
||||
} else if (auth()->user()->user_role == 'doctor') {
|
||||
// redirect to doctor dashboard (TODO)
|
||||
} else {
|
||||
return redirect()->intended(route('admin.dashboard'));
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the case when the authorization code is missing
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function fetchAthleteActivities($accessToken)
|
||||
{
|
||||
$accessToken = session('strava_access_token');
|
||||
|
||||
if ($accessToken) {
|
||||
$activitiesEndpoint = "https://www.strava.com/api/v3/athlete/activities";
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'Authorization' => 'Bearer ' . $accessToken,
|
||||
])->get($activitiesEndpoint);
|
||||
|
||||
$activities = $response->json();
|
||||
//dd($activities);
|
||||
foreach ($activities as $activity) {
|
||||
$existingActivity = PhysicalActivity::where('id', $activity['id'])->first();
|
||||
|
||||
if (!$existingActivity) {
|
||||
$startDate = new \DateTime($activity['start_date_local']);
|
||||
$formattedDate = $startDate->format('Y-m-d H:i:s');
|
||||
|
||||
PhysicalActivity::create([
|
||||
'users_id' => auth()->user()->id,
|
||||
//'id' => $activity['id'],
|
||||
'date' => $formattedDate,
|
||||
'type' => $activity['type'],
|
||||
'distance' => $activity['distance'],
|
||||
'duration' => $activity['moving_time'],
|
||||
'avg_speed' => $activity['average_speed'],
|
||||
'avg_steps' => $activity['average_cadence'] ?? 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $activities;
|
||||
}
|
||||
|
||||
// Handle the case when the access token is missing
|
||||
return redirect()->route('login')->with('error', 'Strava access token not found.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('welcome');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\vendor\Chatify\Api;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use App\Models\ChMessage as Message;
|
||||
use App\Models\ChFavorite as Favorite;
|
||||
use Chatify\Facades\ChatifyMessenger as Chatify;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
||||
class ApiMessagesController extends Controller
|
||||
{
|
||||
protected $perPage = 30;
|
||||
|
||||
/**
|
||||
* Authinticate the connection for pusher
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function pusherAuth(Request $request)
|
||||
{
|
||||
return Chatify::pusherAuth(
|
||||
$request->user(),
|
||||
Auth::user(),
|
||||
$request['channel_name'],
|
||||
$request['socket_id']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch data by id for (user/group)
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function idFetchData(Request $request)
|
||||
{
|
||||
return auth()->user();
|
||||
// Favorite
|
||||
$favorite = Chatify::inFavorite($request['id']);
|
||||
|
||||
// User data
|
||||
if ($request['type'] == 'user') {
|
||||
$fetch = User::where('id', $request['id'])->first();
|
||||
if($fetch){
|
||||
$userAvatar = Chatify::getUserWithAvatar($fetch)->avatar;
|
||||
}
|
||||
}
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'favorite' => $favorite,
|
||||
'fetch' => $fetch ?? null,
|
||||
'user_avatar' => $userAvatar ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method to make a links for the attachments
|
||||
* to be downloadable.
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function download($fileName)
|
||||
{
|
||||
$path = config('chatify.attachments.folder') . '/' . $fileName;
|
||||
if (Chatify::storage()->exists($path)) {
|
||||
return response()->json([
|
||||
'file_name' => $fileName,
|
||||
'download_path' => Chatify::storage()->url($path)
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'message'=>"Sorry, File does not exist in our server or may have been deleted!"
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to database
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JSON response
|
||||
*/
|
||||
public function send(Request $request)
|
||||
{
|
||||
// default variables
|
||||
$error = (object)[
|
||||
'status' => 0,
|
||||
'message' => null
|
||||
];
|
||||
$attachment = null;
|
||||
$attachment_title = null;
|
||||
|
||||
// if there is attachment [file]
|
||||
if ($request->hasFile('file')) {
|
||||
// allowed extensions
|
||||
$allowed_images = Chatify::getAllowedImages();
|
||||
$allowed_files = Chatify::getAllowedFiles();
|
||||
$allowed = array_merge($allowed_images, $allowed_files);
|
||||
|
||||
$file = $request->file('file');
|
||||
// check file size
|
||||
if ($file->getSize() < Chatify::getMaxUploadSize()) {
|
||||
if (in_array(strtolower($file->extension()), $allowed)) {
|
||||
// get attachment name
|
||||
$attachment_title = $file->getClientOriginalName();
|
||||
// upload attachment and store the new name
|
||||
$attachment = Str::uuid() . "." . $file->extension();
|
||||
$file->storeAs(config('chatify.attachments.folder'), $attachment, config('chatify.storage_disk_name'));
|
||||
} else {
|
||||
$error->status = 1;
|
||||
$error->message = "File extension not allowed!";
|
||||
}
|
||||
} else {
|
||||
$error->status = 1;
|
||||
$error->message = "File size you are trying to upload is too large!";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error->status) {
|
||||
// send to database
|
||||
$message = Chatify::newMessage([
|
||||
'type' => $request['type'],
|
||||
'from_id' => Auth::user()->id,
|
||||
'to_id' => $request['id'],
|
||||
'body' => htmlentities(trim($request['message']), ENT_QUOTES, 'UTF-8'),
|
||||
'attachment' => ($attachment) ? json_encode((object)[
|
||||
'new_name' => $attachment,
|
||||
'old_name' => htmlentities(trim($attachment_title), ENT_QUOTES, 'UTF-8'),
|
||||
]) : null,
|
||||
]);
|
||||
|
||||
// fetch message to send it with the response
|
||||
$messageData = Chatify::parseMessage($message);
|
||||
|
||||
// send to user using pusher
|
||||
if (Auth::user()->id != $request['id']) {
|
||||
Chatify::push("private-chatify.".$request['id'], 'messaging', [
|
||||
'from_id' => Auth::user()->id,
|
||||
'to_id' => $request['id'],
|
||||
'message' => $messageData
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => '200',
|
||||
'error' => $error,
|
||||
'message' => $messageData ?? [],
|
||||
'tempID' => $request['temporaryMsgId'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch [user/group] messages from database
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JSON response
|
||||
*/
|
||||
public function fetch(Request $request)
|
||||
{
|
||||
$query = Chatify::fetchMessagesQuery($request['id'])->latest();
|
||||
$messages = $query->paginate($request->per_page ?? $this->perPage);
|
||||
$totalMessages = $messages->total();
|
||||
$lastPage = $messages->lastPage();
|
||||
$response = [
|
||||
'total' => $totalMessages,
|
||||
'last_page' => $lastPage,
|
||||
'last_message_id' => collect($messages->items())->last()->id ?? null,
|
||||
'messages' => $messages->items(),
|
||||
];
|
||||
return Response::json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make messages as seen
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function seen(Request $request)
|
||||
{
|
||||
// make as seen
|
||||
$seen = Chatify::makeSeen($request['id']);
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => $seen,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contacts list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse response
|
||||
*/
|
||||
public function getContacts(Request $request)
|
||||
{
|
||||
// get all users that received/sent message from/to [Auth user]
|
||||
$users = Message::join('users', function ($join) {
|
||||
$join->on('ch_messages.from_id', '=', 'users.id')
|
||||
->orOn('ch_messages.to_id', '=', 'users.id');
|
||||
})
|
||||
->where(function ($q) {
|
||||
$q->where('ch_messages.from_id', Auth::user()->id)
|
||||
->orWhere('ch_messages.to_id', Auth::user()->id);
|
||||
})
|
||||
->where('users.id','!=',Auth::user()->id)
|
||||
->select('users.*',DB::raw('MAX(ch_messages.created_at) max_created_at'))
|
||||
->orderBy('max_created_at', 'desc')
|
||||
->groupBy('users.id')
|
||||
->paginate($request->per_page ?? $this->perPage);
|
||||
|
||||
return response()->json([
|
||||
'contacts' => $users->items(),
|
||||
'total' => $users->total() ?? 0,
|
||||
'last_page' => $users->lastPage() ?? 1,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put a user in the favorites list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function favorite(Request $request)
|
||||
{
|
||||
$userId = $request['user_id'];
|
||||
// check action [star/unstar]
|
||||
$favoriteStatus = Chatify::inFavorite($userId) ? 0 : 1;
|
||||
Chatify::makeInFavorite($userId, $favoriteStatus);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => @$favoriteStatus,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get favorites list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function getFavorites(Request $request)
|
||||
{
|
||||
$favorites = Favorite::where('user_id', Auth::user()->id)->get();
|
||||
foreach ($favorites as $favorite) {
|
||||
$favorite->user = User::where('id', $favorite->favorite_id)->first();
|
||||
}
|
||||
return Response::json([
|
||||
'total' => count($favorites),
|
||||
'favorites' => $favorites ?? [],
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in messenger
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$input = trim(filter_var($request['input']));
|
||||
$records = User::where('id','!=',Auth::user()->id)
|
||||
->where('name', 'LIKE', "%{$input}%")
|
||||
->paginate($request->per_page ?? $this->perPage);
|
||||
|
||||
foreach ($records->items() as $index => $record) {
|
||||
$records[$index] += Chatify::getUserWithAvatar($record);
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
'records' => $records->items(),
|
||||
'total' => $records->total(),
|
||||
'last_page' => $records->lastPage()
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shared photos
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function sharedPhotos(Request $request)
|
||||
{
|
||||
$images = Chatify::getSharedPhotos($request['user_id']);
|
||||
|
||||
foreach ($images as $image) {
|
||||
$image = asset(config('chatify.attachments.folder') . $image);
|
||||
}
|
||||
// send the response
|
||||
return Response::json([
|
||||
'shared' => $images ?? [],
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete conversation
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function deleteConversation(Request $request)
|
||||
{
|
||||
// delete
|
||||
$delete = Chatify::deleteConversation($request['id']);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'deleted' => $delete ? 1 : 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function updateSettings(Request $request)
|
||||
{
|
||||
$msg = null;
|
||||
$error = $success = 0;
|
||||
|
||||
// dark mode
|
||||
if ($request['dark_mode']) {
|
||||
$request['dark_mode'] == "dark"
|
||||
? User::where('id', Auth::user()->id)->update(['dark_mode' => 1]) // Make Dark
|
||||
: User::where('id', Auth::user()->id)->update(['dark_mode' => 0]); // Make Light
|
||||
}
|
||||
|
||||
// If messenger color selected
|
||||
if ($request['messengerColor']) {
|
||||
$messenger_color = trim(filter_var($request['messengerColor']));
|
||||
User::where('id', Auth::user()->id)
|
||||
->update(['messenger_color' => $messenger_color]);
|
||||
}
|
||||
// if there is a [file]
|
||||
if ($request->hasFile('avatar')) {
|
||||
// allowed extensions
|
||||
$allowed_images = Chatify::getAllowedImages();
|
||||
|
||||
$file = $request->file('avatar');
|
||||
// check file size
|
||||
if ($file->getSize() < Chatify::getMaxUploadSize()) {
|
||||
if (in_array(strtolower($file->extension()), $allowed_images)) {
|
||||
// delete the older one
|
||||
if (Auth::user()->avatar != config('chatify.user_avatar.default')) {
|
||||
$path = Chatify::getUserAvatarUrl(Auth::user()->avatar);
|
||||
if (Chatify::storage()->exists($path)) {
|
||||
Chatify::storage()->delete($path);
|
||||
}
|
||||
}
|
||||
// upload
|
||||
$avatar = Str::uuid() . "." . $file->extension();
|
||||
$update = User::where('id', Auth::user()->id)->update(['avatar' => $avatar]);
|
||||
$file->storeAs(config('chatify.user_avatar.folder'), $avatar, config('chatify.storage_disk_name'));
|
||||
$success = $update ? 1 : 0;
|
||||
} else {
|
||||
$msg = "File extension not allowed!";
|
||||
$error = 1;
|
||||
}
|
||||
} else {
|
||||
$msg = "File size you are trying to upload is too large!";
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => $success ? 1 : 0,
|
||||
'error' => $error ? 1 : 0,
|
||||
'message' => $error ? $msg : 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user's active status
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function setActiveStatus(Request $request)
|
||||
{
|
||||
$activeStatus = $request['status'] > 0 ? 1 : 0;
|
||||
$status = User::where('id', Auth::user()->id)->update(['active_status' => $activeStatus]);
|
||||
return Response::json([
|
||||
'status' => $status,
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\vendor\Chatify;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use App\Models\User;
|
||||
use App\Models\ChMessage as Message;
|
||||
use App\Models\ChFavorite as Favorite;
|
||||
use Chatify\Facades\ChatifyMessenger as Chatify;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Request as FacadesRequest;
|
||||
use Illuminate\Support\Str;
|
||||
class MessagesController extends Controller
|
||||
{
|
||||
protected $perPage = 30;
|
||||
|
||||
/**
|
||||
* Authenticate the connection for pusher
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function pusherAuth(Request $request)
|
||||
{
|
||||
return Chatify::pusherAuth(
|
||||
$request->user(),
|
||||
Auth::user(),
|
||||
$request['channel_name'],
|
||||
$request['socket_id']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returning the view of the app with the required data.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index( $id = null)
|
||||
{
|
||||
$messenger_color = Auth::user()->messenger_color;
|
||||
return view('Chatify::pages.app', [
|
||||
'id' => $id ?? 0,
|
||||
'messengerColor' => $messenger_color ? $messenger_color : Chatify::getFallbackColor(),
|
||||
'dark_mode' => Auth::user()->dark_mode < 1 ? 'light' : 'dark',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch data (user, favorite.. etc).
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function idFetchData(Request $request)
|
||||
{
|
||||
$favorite = Chatify::inFavorite($request['id']);
|
||||
$fetch = User::where('id', $request['id'])->first();
|
||||
if($fetch){
|
||||
$userAvatar = Chatify::getUserWithAvatar($fetch)->avatar;
|
||||
}
|
||||
return Response::json([
|
||||
'favorite' => $favorite,
|
||||
'fetch' => $fetch ?? null,
|
||||
'user_avatar' => $userAvatar ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method to make a links for the attachments
|
||||
* to be downloadable.
|
||||
*
|
||||
* @param string $fileName
|
||||
* @return \Symfony\Component\HttpFoundation\StreamedResponse|void
|
||||
*/
|
||||
public function download($fileName)
|
||||
{
|
||||
$filePath = config('chatify.attachments.folder') . '/' . $fileName;
|
||||
if (Chatify::storage()->exists($filePath)) {
|
||||
return Chatify::storage()->download($filePath);
|
||||
}
|
||||
return abort(404, "Sorry, File does not exist in our server or may have been deleted!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to database
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function send(Request $request)
|
||||
{
|
||||
// default variables
|
||||
$error = (object)[
|
||||
'status' => 0,
|
||||
'message' => null
|
||||
];
|
||||
$attachment = null;
|
||||
$attachment_title = null;
|
||||
|
||||
// if there is attachment [file]
|
||||
if ($request->hasFile('file')) {
|
||||
// allowed extensions
|
||||
$allowed_images = Chatify::getAllowedImages();
|
||||
$allowed_files = Chatify::getAllowedFiles();
|
||||
$allowed = array_merge($allowed_images, $allowed_files);
|
||||
|
||||
$file = $request->file('file');
|
||||
// check file size
|
||||
if ($file->getSize() < Chatify::getMaxUploadSize()) {
|
||||
if (in_array(strtolower($file->extension()), $allowed)) {
|
||||
// get attachment name
|
||||
$attachment_title = $file->getClientOriginalName();
|
||||
// upload attachment and store the new name
|
||||
$attachment = Str::uuid() . "." . $file->extension();
|
||||
$file->storeAs(config('chatify.attachments.folder'), $attachment, config('chatify.storage_disk_name'));
|
||||
} else {
|
||||
$error->status = 1;
|
||||
$error->message = "File extension not allowed!";
|
||||
}
|
||||
} else {
|
||||
$error->status = 1;
|
||||
$error->message = "File size you are trying to upload is too large!";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error->status) {
|
||||
$message = Chatify::newMessage([
|
||||
'from_id' => Auth::user()->id,
|
||||
'to_id' => $request['id'],
|
||||
'body' => htmlentities(trim($request['message']), ENT_QUOTES, 'UTF-8'),
|
||||
'attachment' => ($attachment) ? json_encode((object)[
|
||||
'new_name' => $attachment,
|
||||
'old_name' => htmlentities(trim($attachment_title), ENT_QUOTES, 'UTF-8'),
|
||||
]) : null,
|
||||
]);
|
||||
$messageData = Chatify::parseMessage($message);
|
||||
if (Auth::user()->id != $request['id']) {
|
||||
Chatify::push("private-chatify.".$request['id'], 'messaging', [
|
||||
'from_id' => Auth::user()->id,
|
||||
'to_id' => $request['id'],
|
||||
'message' => Chatify::messageCard($messageData, true)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => '200',
|
||||
'error' => $error,
|
||||
'message' => Chatify::messageCard(@$messageData),
|
||||
'tempID' => $request['temporaryMsgId'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch [user/group] messages from database
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request)
|
||||
{
|
||||
$query = Chatify::fetchMessagesQuery($request['id'])->latest();
|
||||
$messages = $query->paginate($request->per_page ?? $this->perPage);
|
||||
$totalMessages = $messages->total();
|
||||
$lastPage = $messages->lastPage();
|
||||
$response = [
|
||||
'total' => $totalMessages,
|
||||
'last_page' => $lastPage,
|
||||
'last_message_id' => collect($messages->items())->last()->id ?? null,
|
||||
'messages' => '',
|
||||
];
|
||||
|
||||
// if there is no messages yet.
|
||||
if ($totalMessages < 1) {
|
||||
$response['messages'] ='<p class="message-hint center-el"><span>Say \'hi\' and start messaging</span></p>';
|
||||
return Response::json($response);
|
||||
}
|
||||
if (count($messages->items()) < 1) {
|
||||
$response['messages'] = '';
|
||||
return Response::json($response);
|
||||
}
|
||||
$allMessages = null;
|
||||
foreach ($messages->reverse() as $message) {
|
||||
$allMessages .= Chatify::messageCard(
|
||||
Chatify::parseMessage($message)
|
||||
);
|
||||
}
|
||||
$response['messages'] = $allMessages;
|
||||
return Response::json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make messages as seen
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse|void
|
||||
*/
|
||||
public function seen(Request $request)
|
||||
{
|
||||
// make as seen
|
||||
$seen = Chatify::makeSeen($request['id']);
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => $seen,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contacts list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getContacts(Request $request)
|
||||
{
|
||||
// get all users that received/sent message from/to [Auth user]
|
||||
$users = Message::join('users', function ($join) {
|
||||
$join->on('ch_messages.from_id', '=', 'users.id')
|
||||
->orOn('ch_messages.to_id', '=', 'users.id');
|
||||
})
|
||||
->where(function ($q) {
|
||||
$q->where('ch_messages.from_id', Auth::user()->id)
|
||||
->orWhere('ch_messages.to_id', Auth::user()->id);
|
||||
})
|
||||
->where('users.id','!=',Auth::user()->id)
|
||||
->select('users.*',DB::raw('MAX(ch_messages.created_at) max_created_at'))
|
||||
->orderBy('max_created_at', 'desc')
|
||||
->groupBy('users.id')
|
||||
->paginate($request->per_page ?? $this->perPage);
|
||||
|
||||
$usersList = $users->items();
|
||||
|
||||
if (count($usersList) > 0) {
|
||||
$contacts = '';
|
||||
foreach ($usersList as $user) {
|
||||
$contacts .= Chatify::getContactItem($user);
|
||||
}
|
||||
} else {
|
||||
$contacts = '<p class="message-hint center-el"><span>Your contact list is empty</span></p>';
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
'contacts' => $contacts,
|
||||
'total' => $users->total() ?? 0,
|
||||
'last_page' => $users->lastPage() ?? 1,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user's list item data
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function updateContactItem(Request $request)
|
||||
{
|
||||
// Get user data
|
||||
$user = User::where('id', $request['user_id'])->first();
|
||||
if(!$user){
|
||||
return Response::json([
|
||||
'message' => 'User not found!',
|
||||
], 401);
|
||||
}
|
||||
$contactItem = Chatify::getContactItem($user);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'contactItem' => $contactItem,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put a user in the favorites list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse|void
|
||||
*/
|
||||
public function favorite(Request $request)
|
||||
{
|
||||
$userId = $request['user_id'];
|
||||
// check action [star/unstar]
|
||||
$favoriteStatus = Chatify::inFavorite($userId) ? 0 : 1;
|
||||
Chatify::makeInFavorite($userId, $favoriteStatus);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => @$favoriteStatus,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get favorites list
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse|void
|
||||
*/
|
||||
public function getFavorites(Request $request)
|
||||
{
|
||||
$favoritesList = null;
|
||||
$favorites = Favorite::where('user_id', Auth::user()->id);
|
||||
foreach ($favorites->get() as $favorite) {
|
||||
// get user data
|
||||
$user = User::where('id', $favorite->favorite_id)->first();
|
||||
$favoritesList .= view('Chatify::layouts.favorite', [
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
// send the response
|
||||
return Response::json([
|
||||
'count' => $favorites->count(),
|
||||
'favorites' => $favorites->count() > 0
|
||||
? $favoritesList
|
||||
: 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search in messenger
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse|void
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$getRecords = null;
|
||||
$input = trim(filter_var($request['input']));
|
||||
$records = User::where('id','!=',Auth::user()->id)
|
||||
->where('name', 'LIKE', "%{$input}%")
|
||||
->paginate($request->per_page ?? $this->perPage);
|
||||
foreach ($records->items() as $record) {
|
||||
$getRecords .= view('Chatify::layouts.listItem', [
|
||||
'get' => 'search_item',
|
||||
'user' => Chatify::getUserWithAvatar($record),
|
||||
])->render();
|
||||
}
|
||||
if($records->total() < 1){
|
||||
$getRecords = '<p class="message-hint center-el"><span>Nothing to show.</span></p>';
|
||||
}
|
||||
// send the response
|
||||
return Response::json([
|
||||
'records' => $getRecords,
|
||||
'total' => $records->total(),
|
||||
'last_page' => $records->lastPage()
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shared photos
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse|void
|
||||
*/
|
||||
public function sharedPhotos(Request $request)
|
||||
{
|
||||
$shared = Chatify::getSharedPhotos($request['user_id']);
|
||||
$sharedPhotos = null;
|
||||
|
||||
// shared with its template
|
||||
for ($i = 0; $i < count($shared); $i++) {
|
||||
$sharedPhotos .= view('Chatify::layouts.listItem', [
|
||||
'get' => 'sharedPhoto',
|
||||
'image' => Chatify::getAttachmentUrl($shared[$i]),
|
||||
])->render();
|
||||
}
|
||||
// send the response
|
||||
return Response::json([
|
||||
'shared' => count($shared) > 0 ? $sharedPhotos : '<p class="message-hint"><span>Nothing shared yet</span></p>',
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete conversation
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function deleteConversation(Request $request)
|
||||
{
|
||||
// delete
|
||||
$delete = Chatify::deleteConversation($request['id']);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'deleted' => $delete ? 1 : 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete message
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function deleteMessage(Request $request)
|
||||
{
|
||||
// delete
|
||||
$delete = Chatify::deleteMessage($request['id']);
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'deleted' => $delete ? 1 : 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function updateSettings(Request $request)
|
||||
{
|
||||
$msg = null;
|
||||
$error = $success = 0;
|
||||
|
||||
// dark mode
|
||||
if ($request['dark_mode']) {
|
||||
$request['dark_mode'] == "dark"
|
||||
? User::where('id', Auth::user()->id)->update(['dark_mode' => 1]) // Make Dark
|
||||
: User::where('id', Auth::user()->id)->update(['dark_mode' => 0]); // Make Light
|
||||
}
|
||||
|
||||
// If messenger color selected
|
||||
if ($request['messengerColor']) {
|
||||
$messenger_color = trim(filter_var($request['messengerColor']));
|
||||
User::where('id', Auth::user()->id)
|
||||
->update(['messenger_color' => $messenger_color]);
|
||||
}
|
||||
// if there is a [file]
|
||||
if ($request->hasFile('avatar')) {
|
||||
// allowed extensions
|
||||
$allowed_images = Chatify::getAllowedImages();
|
||||
|
||||
$file = $request->file('avatar');
|
||||
// check file size
|
||||
if ($file->getSize() < Chatify::getMaxUploadSize()) {
|
||||
if (in_array(strtolower($file->extension()), $allowed_images)) {
|
||||
// delete the older one
|
||||
if (Auth::user()->avatar != config('chatify.user_avatar.default')) {
|
||||
$avatar = Auth::user()->avatar;
|
||||
if (Chatify::storage()->exists($avatar)) {
|
||||
Chatify::storage()->delete($avatar);
|
||||
}
|
||||
}
|
||||
// upload
|
||||
$avatar = Str::uuid() . "." . $file->extension();
|
||||
$update = User::where('id', Auth::user()->id)->update(['avatar' => $avatar]);
|
||||
$file->storeAs(config('chatify.user_avatar.folder'), $avatar, config('chatify.storage_disk_name'));
|
||||
$success = $update ? 1 : 0;
|
||||
} else {
|
||||
$msg = "File extension not allowed!";
|
||||
$error = 1;
|
||||
}
|
||||
} else {
|
||||
$msg = "File size you are trying to upload is too large!";
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// send the response
|
||||
return Response::json([
|
||||
'status' => $success ? 1 : 0,
|
||||
'error' => $error ? 1 : 0,
|
||||
'message' => $error ? $msg : 0,
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user's active status
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function setActiveStatus(Request $request)
|
||||
{
|
||||
$activeStatus = $request['status'] > 0 ? 1 : 0;
|
||||
$status = User::where('id', Auth::user()->id)->update(['active_status' => $activeStatus]);
|
||||
return Response::json([
|
||||
'status' => $status,
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectBasedOnRole
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
$user = Auth::user();
|
||||
if ($user->user_role == 'user') {
|
||||
if ($request->route()->getName() !== 'dashboard') {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
} elseif ($user->user_role == 'doctor') {
|
||||
// redirect to doctor dashboard (TODO)
|
||||
// if ($request->route()->getName() !== 'doctor.dashboard') {
|
||||
// return redirect()->route('doctor.dashboard');
|
||||
// }
|
||||
} elseif ($user->user_role == 'admin') {
|
||||
if ($request->route()->getName() !== 'admin.dashboard') {
|
||||
return redirect()->route('admin.dashboard');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Auth\Events\Lockout;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to authenticate the request's credentials.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function authenticate()
|
||||
{
|
||||
$this->ensureIsNotRateLimited();
|
||||
|
||||
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||
RateLimiter::hit($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => trans('auth.failed'),
|
||||
]);
|
||||
}
|
||||
|
||||
RateLimiter::clear($this->throttleKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the login request is not rate limited.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function ensureIsNotRateLimited(): void
|
||||
{
|
||||
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event(new Lockout($this));
|
||||
|
||||
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => trans('auth.throttle', [
|
||||
'seconds' => $seconds,
|
||||
'minutes' => ceil($seconds / 60),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rate limiting throttle key for the request.
|
||||
*/
|
||||
public function throttleKey(): string
|
||||
{
|
||||
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ProfileUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Chatify\Traits\UUID;
|
||||
|
||||
class ChFavorite extends Model
|
||||
{
|
||||
use UUID;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Chatify\Traits\UUID;
|
||||
|
||||
class ChMessage extends Model
|
||||
{
|
||||
use UUID;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Consultation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'patient_id',
|
||||
'doctor_id',
|
||||
'consultation_date',
|
||||
'consultation_time',
|
||||
'location',
|
||||
'consultation_status',
|
||||
];
|
||||
|
||||
public function patient()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'patient_id');
|
||||
}
|
||||
|
||||
public function doctor()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'doctor_id');
|
||||
}
|
||||
|
||||
public function result()
|
||||
{
|
||||
return $this->hasOne(Result::class, 'consultation_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HealthData extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'health_datas';
|
||||
|
||||
protected $fillable = [
|
||||
'users_id',
|
||||
'birthdate',
|
||||
'weight',
|
||||
'height',
|
||||
'sleeptime',
|
||||
'disease',
|
||||
'food',
|
||||
'alergi_makanan',
|
||||
'obesity_status',
|
||||
'calorie_recommendation',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'users_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notification extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'consultation_id',
|
||||
'message',
|
||||
'is_read',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function consultation()
|
||||
{
|
||||
return $this->belongsTo(Consultation::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PhysicalActivity extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'users_id',
|
||||
//'id',
|
||||
'date',
|
||||
'type',
|
||||
'distance',
|
||||
'duration',
|
||||
'avg_speed',
|
||||
'avg_steps',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'users_id');
|
||||
}
|
||||
|
||||
public function calculateCaloriesBurned()
|
||||
{
|
||||
$user = $this->user;
|
||||
$healthData = $user->healthDatas()->latest()->first();
|
||||
$weight = $healthData ? $healthData->weight : 0;
|
||||
|
||||
$duration = $this->duration / 3600; // Convert duration from seconds to minutes
|
||||
$caloriesBurned = 0;
|
||||
|
||||
switch ($this->type) {
|
||||
case 'bicycle':
|
||||
$caloriesBurned = 0.061 * $weight * $duration;
|
||||
break;
|
||||
case 'Run':
|
||||
$caloriesBurned = 9.8 * $weight * $duration;
|
||||
break;
|
||||
case 'walk':
|
||||
$caloriesBurned = 0.035 * $weight * $duration;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return round($caloriesBurned, 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Result extends Model
|
||||
{
|
||||
protected $table = 'result';
|
||||
|
||||
protected $fillable = [
|
||||
'patient_id',
|
||||
'doctor_id',
|
||||
'consultation_id',
|
||||
'jarak_lari',
|
||||
'sleeptime',
|
||||
'food',
|
||||
'unrecommended_food',
|
||||
'notes',
|
||||
];
|
||||
|
||||
public function patient()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'patient_id');
|
||||
}
|
||||
|
||||
public function doctor()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'doctor_id');
|
||||
}
|
||||
|
||||
public function consultation()
|
||||
{
|
||||
return $this->belongsTo(Consultation::class, 'consultation_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'user_role',
|
||||
'username',
|
||||
'password',
|
||||
'name',
|
||||
'email',
|
||||
'telepon',
|
||||
'alamat',
|
||||
'gender'
|
||||
];
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
public function physicalActivities()
|
||||
{
|
||||
return $this->hasMany(PhysicalActivity::class, 'users_id');
|
||||
}
|
||||
|
||||
public function healthDatas()
|
||||
{
|
||||
return $this->hasMany(HealthData::class, 'users_id');
|
||||
}
|
||||
|
||||
public function patientResults()
|
||||
{
|
||||
return $this->hasMany(Result::class, 'patient_id');
|
||||
}
|
||||
|
||||
public function doctorResults()
|
||||
{
|
||||
return $this->hasMany(Result::class, 'doctor_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.app');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class GuestLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('layouts.guest');
|
||||
}
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
$status = (require_once __DIR__.'/bootstrap/app.php')
|
||||
->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use App\Http\Middleware\RedirectBasedOnRole;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
channels: __DIR__.'/../routes/channels.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->alias([
|
||||
'role' => RedirectBasedOnRole::class
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
})->create();
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
];
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^11.0",
|
||||
"laravel/reverb": "@beta",
|
||||
"laravel/tinker": "^2.9",
|
||||
"munafio/chatify": "^1.6",
|
||||
"pusher/pusher-php-server": "^7.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/breeze": "^2.0",
|
||||
"laravel/pint": "^1.13",
|
||||
"laravel/sail": "^1.26",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"phpunit/phpunit": "^11.0",
|
||||
"spatie/laravel-ignition": "^2.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
Generated
+9293
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => env('APP_TIMEZONE', 'UTC'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "reverb", "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_CONNECTION', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over WebSockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'reverb' => [
|
||||
'driver' => 'reverb',
|
||||
'key' => env('REVERB_APP_KEY'),
|
||||
'secret' => env('REVERB_APP_SECRET'),
|
||||
'app_id' => env('REVERB_APP_ID'),
|
||||
'options' => [
|
||||
'host' => env('REVERB_HOST'),
|
||||
'port' => env('REVERB_PORT', 443),
|
||||
'scheme' => env('REVERB_SCHEME', 'https'),
|
||||
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'connection' => env('DB_CACHE_CONNECTION', null),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION', null),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Messenger display name
|
||||
|-------------------------------------
|
||||
*/
|
||||
'name' => env('CHATIFY_NAME', 'Aigo Messanger'),
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| The disk on which to store added
|
||||
| files and derived images by default.
|
||||
|-------------------------------------
|
||||
*/
|
||||
'storage_disk_name' => env('CHATIFY_STORAGE_DISK', 'public'),
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Routes configurations
|
||||
|-------------------------------------
|
||||
*/
|
||||
'routes' => [
|
||||
'custom' => env('CHATIFY_CUSTOM_ROUTES', true),
|
||||
'prefix' => env('CHATIFY_ROUTES_PREFIX', 'aigochat'),
|
||||
'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']),
|
||||
'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'),
|
||||
],
|
||||
'api_routes' => [
|
||||
'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify/api'),
|
||||
'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']),
|
||||
'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api'),
|
||||
],
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Pusher API credentials
|
||||
|-------------------------------------
|
||||
*/
|
||||
'pusher' => [
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER', 'ap1'),
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'ap1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| User Avatar
|
||||
|-------------------------------------
|
||||
*/
|
||||
'user_avatar' => [
|
||||
'folder' => 'users-avatar',
|
||||
'default' => 'avatar.png',
|
||||
],
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Gravatar
|
||||
|
|
||||
| imageset property options:
|
||||
| [ 404 | mp | identicon (default) | monsterid | wavatar ]
|
||||
|-------------------------------------
|
||||
*/
|
||||
'gravatar' => [
|
||||
'enabled' => true,
|
||||
'image_size' => 200,
|
||||
'imageset' => 'identicon'
|
||||
],
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Attachments
|
||||
|-------------------------------------
|
||||
*/
|
||||
'attachments' => [
|
||||
'folder' => 'attachments',
|
||||
'download_route_name' => 'attachments.download',
|
||||
'allowed_images' => (array) ['png','jpg','jpeg','gif'],
|
||||
'allowed_files' => (array) ['zip','rar','txt'],
|
||||
'max_upload_size' => env('CHATIFY_MAX_FILE_SIZE', 150), // MB
|
||||
],
|
||||
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Messenger's colors
|
||||
|-------------------------------------
|
||||
*/
|
||||
'colors' => (array) [
|
||||
'#2180f3',
|
||||
'#2196F3',
|
||||
'#00BCD4',
|
||||
'#3F51B5',
|
||||
'#673AB7',
|
||||
'#4CAF50',
|
||||
'#FFC107',
|
||||
'#FF9800',
|
||||
'#ff2522',
|
||||
'#9C27B0',
|
||||
],
|
||||
/*
|
||||
|-------------------------------------
|
||||
| Sounds
|
||||
| You can enable/disable the sounds and
|
||||
| change sound's name/path placed at
|
||||
| `public/` directory of your app.
|
||||
|
|
||||
|-------------------------------------
|
||||
*/
|
||||
'sounds' => [
|
||||
'enabled' => true,
|
||||
'public_path' => 'sounds/chatify',
|
||||
'new_message' => 'new-message-sound.mp3',
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "log", "array", "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION', null),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Reverb Server
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default server used by Reverb to handle
|
||||
| incoming messages as well as broadcasting message to all your
|
||||
| connected clients. At this time only "reverb" is supported.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('REVERB_SERVER', 'reverb'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverb Servers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define details for each of the supported Reverb servers.
|
||||
| Each server has its own configuration options that are defined in
|
||||
| the array below. You should ensure all the options are present.
|
||||
|
|
||||
*/
|
||||
|
||||
'servers' => [
|
||||
|
||||
'reverb' => [
|
||||
'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
|
||||
'port' => env('REVERB_SERVER_PORT', 8080),
|
||||
'hostname' => env('REVERB_HOST'),
|
||||
'options' => [
|
||||
'tls' => [],
|
||||
],
|
||||
'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
|
||||
'scaling' => [
|
||||
'enabled' => env('REVERB_SCALING_ENABLED', false),
|
||||
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
|
||||
],
|
||||
'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverb Applications
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define how Reverb applications are managed. If you choose
|
||||
| to use the "config" provider, you may define an array of apps which
|
||||
| your server will support, including their connection credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'apps' => [
|
||||
|
||||
'provider' => 'config',
|
||||
|
||||
'apps' => [
|
||||
[
|
||||
'key' => env('REVERB_APP_KEY'),
|
||||
'secret' => env('REVERB_APP_SECRET'),
|
||||
'app_id' => env('REVERB_APP_ID'),
|
||||
'options' => [
|
||||
'host' => env('REVERB_HOST'),
|
||||
'port' => env('REVERB_PORT', 443),
|
||||
'scheme' => env('REVERB_SCHEME', 'https'),
|
||||
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'allowed_origins' => ['*'],
|
||||
'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
|
||||
'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Consultation;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Consultation>
|
||||
*/
|
||||
class ConsultationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = Consultation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
// Get a random patient from the users table
|
||||
$patient = User::where('user_role', 'user')->inRandomOrder()->first();
|
||||
|
||||
// Get a random doctor from the users table
|
||||
$doctor = User::where('user_role', 'doctor')->inRandomOrder()->first();
|
||||
|
||||
return [
|
||||
'patient_id' => $patient->id,
|
||||
'doctor_id' => $doctor->id,
|
||||
'consultation_date' => $this->faker->dateTimeBetween('-1 year', '+1 year')->format('Y-m-d'),
|
||||
'consultation_time' => $this->faker->time('H:i:s'),
|
||||
'location' => $this->faker->city,
|
||||
'consultation_status' => $this->faker->randomElement(['pending', 'declined', 'approved', 'finished']),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\User;
|
||||
use Faker\Factory as FakerFactory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$faker = FakerFactory::create('en_US');
|
||||
return [
|
||||
'user_role' => $faker->randomElement(['admin', 'user', 'doctor']),
|
||||
'username' => $faker->userName,
|
||||
'password' => Hash::make('password'),
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'telepon' => $faker->phoneNumber,
|
||||
'alamat' => $faker->address,
|
||||
'gender' => $faker->randomElement(['male', 'female']),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('user_role');
|
||||
$table->string('username')->unique();
|
||||
$table->string('password');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('telepon');
|
||||
$table->string('alamat');
|
||||
$table->string('gender');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('health_datas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('users_id')->constrained('users')->onDelete('cascade');
|
||||
$table->date('birthdate');
|
||||
$table->float('weight');
|
||||
$table->float('height');
|
||||
$table->integer('sleeptime');
|
||||
$table->string('disease');
|
||||
$table->string('food');
|
||||
$table->string('alergi_makanan');
|
||||
$table->string('obesity_status')->nullable();
|
||||
$table->integer('calorie_recommendation')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('health_datas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('physical_activities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('users_id')->constrained('users')->onDelete('cascade');
|
||||
$table->timestamp('date');
|
||||
$table->string('type');
|
||||
$table->decimal('distance', 8, 2);
|
||||
$table->integer('duration');
|
||||
$table->decimal('avg_speed', 8, 2);
|
||||
$table->integer('avg_steps');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('physical_activities');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddActiveStatusToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
// if not exist, add the new column
|
||||
if (!Schema::hasColumn('users', 'active_status')) {
|
||||
$table->boolean('active_status')->default(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('active_status');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAvatarToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
// if not exist, add the new column
|
||||
if (!Schema::hasColumn('users', 'avatar')) {
|
||||
$table->string('avatar')->default(config('chatify.user_avatar.default'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('avatar');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDarkModeToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
// if not exist, add the new column
|
||||
if (!Schema::hasColumn('users', 'dark_mode')) {
|
||||
$table->boolean('dark_mode')->default(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('dark_mode');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMessengerColorToUsers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'messenger_color')) {
|
||||
$table->string('messenger_color')->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('messenger_color');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateChatifyFavoritesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ch_favorites', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->bigInteger('user_id');
|
||||
$table->bigInteger('favorite_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ch_favorites');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateChatifyMessagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ch_messages', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->bigInteger('from_id');
|
||||
$table->bigInteger('to_id');
|
||||
$table->string('body',5000)->nullable();
|
||||
$table->string('attachment')->nullable();
|
||||
$table->boolean('seen')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ch_messages');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('consultations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('patient_id');
|
||||
$table->unsignedBigInteger('doctor_id');
|
||||
$table->date('consultation_date');
|
||||
$table->time('consultation_time');
|
||||
$table->string('location');
|
||||
$table->string('consultation_status')->default('pending');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('patient_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('doctor_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('consultations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->unsignedBigInteger('consultation_id');
|
||||
$table->string('message');
|
||||
$table->boolean('is_read')->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('consultation_id')->references('id')->on('consultations')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('result', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('patient_id');
|
||||
$table->unsignedBigInteger('doctor_id');
|
||||
$table->unsignedBigInteger('consultation_id')->nullable();
|
||||
$table->integer('jarak_lari');
|
||||
$table->float('sleeptime');
|
||||
$table->string('food');
|
||||
$table->string('unrecommended_food');
|
||||
$table->text('notes');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('patient_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('doctor_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('consultation_id')->references('id')->on('consultations')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('result');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ConsultationSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
\App\Models\Consultation::factory()->count(15)->create();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Consultation;
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
User::factory()->count(2)->create([
|
||||
'user_role' => 'user',
|
||||
]);
|
||||
|
||||
User::factory()->count(1)->create([
|
||||
'user_role' => 'doctor',
|
||||
]);
|
||||
|
||||
User::factory()->count(1)->create([
|
||||
'user_role' => 'admin',
|
||||
]);
|
||||
|
||||
$this->call([
|
||||
ConsultationSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\User;
|
||||
use Database\Factories\UserFactory;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
UserFactory::new()->count(10)->create();
|
||||
}
|
||||
}
|
||||
Generated
+2433
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/forms": "^0.5.2",
|
||||
"alpinejs": "^3.4.2",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"axios": "^1.6.4",
|
||||
"laravel-echo": "^1.16.0",
|
||||
"laravel-vite-plugin": "^1.0",
|
||||
"postcss": "^8.4.31",
|
||||
"pusher-js": "^8.4.0-rc2",
|
||||
"tailwindcss": "^3.1.0",
|
||||
"vite": "^5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap-icons": "^1.11.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,166 @@
|
||||
.appointment-card {
|
||||
border-radius: 20px;
|
||||
box-shadow: 0px 8px 30px 0px rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
align-items: start;
|
||||
gap: 10px;
|
||||
max-width: 600px;
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.patient-avatar {
|
||||
background-color: #a4bbe9;
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.patient-info {
|
||||
display: flex;
|
||||
margin-top: 8px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.patient-name {
|
||||
color: #1c2541;
|
||||
font: 500 16px/75% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.patient-email {
|
||||
color: #8296c5;
|
||||
margin-top: 2px;
|
||||
font: 400 14px/86% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.appointment-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 330px;
|
||||
font-size: 14px;
|
||||
color: #384c7f;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.location-info {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.location-icon {
|
||||
width: 18px;
|
||||
fill: #384c7f;
|
||||
}
|
||||
|
||||
.location-text {
|
||||
font-family: Poppins, sans-serif;
|
||||
flex-grow: 1;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.date-time-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.date-info {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin: auto -5px auto 0;
|
||||
}
|
||||
|
||||
.date-icon {
|
||||
width: 20px;
|
||||
stroke: #384c7f;
|
||||
}
|
||||
|
||||
.date-text {
|
||||
font-family: Poppins, sans-serif;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
display: flex;
|
||||
gap: 9px;
|
||||
}
|
||||
|
||||
.time-icon {
|
||||
width: 20px;
|
||||
fill: #384c7f;
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-family: Poppins, sans-serif;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.approve-button {
|
||||
border-style: none;
|
||||
border-radius: 50px;
|
||||
background-color: var(--Green-2, #51dbd3);
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 2px 46px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.approve-button:hover {
|
||||
background-color: #37b3b7;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.approve-icon {
|
||||
width: 40px;
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
fill: #fff;
|
||||
filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
|
||||
.approve-text {
|
||||
margin: auto 0;
|
||||
color: var(--Green-5, #15647a);
|
||||
font: 500 14px/193% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.decline-button {
|
||||
border-style: none;
|
||||
border-radius: 50px;
|
||||
background-color: #faced7;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 2px 50px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.decline-button:hover {
|
||||
background-color: #f7b8c5;
|
||||
}
|
||||
|
||||
.decline-icon-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.decline-icon {
|
||||
width: 40px;
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
fill: #fff;
|
||||
filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
|
||||
.decline-text {
|
||||
margin: auto 0;
|
||||
color: #cc2a2a;
|
||||
font: 500 14px/193% Poppins, sans-serif;
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
h3,
|
||||
h4,
|
||||
h5 {
|
||||
font-family: "Poppins";
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 250px;
|
||||
}
|
||||
|
||||
.activity-container {
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 8px 30px 0 rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
padding: 0 14px 0 0;
|
||||
gap: 12px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.summary-icon-wrapper {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 20px;
|
||||
background-color: #fecd5a;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
color: #1c1c30;
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
padding: 0 30px;
|
||||
}
|
||||
|
||||
.summary-icon {
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
width: 39px;
|
||||
fill: #1c1c30;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.summary-text {
|
||||
font-family: Poppins, sans-serif;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.summary-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.summary-count {
|
||||
color: #efa800;
|
||||
font: 600 28px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.summary-unit {
|
||||
color: #384c7f;
|
||||
font: 400 14px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.calories-container {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
background-color: #eaecff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.calories-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.calories-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
flex-basis: 0;
|
||||
width: fit-content;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.calories-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.calories-label {
|
||||
color: #384c7f;
|
||||
font-family: Poppins, sans-serif;
|
||||
font-weight: 500;
|
||||
font-size: medium;
|
||||
}
|
||||
|
||||
.calories-value {
|
||||
color: #8296c5;
|
||||
text-align: right;
|
||||
font-size: 15px;
|
||||
font-family: Poppins, sans-serif;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.calories-value .calories-total {
|
||||
font-weight: 500;
|
||||
font-size: 18px;
|
||||
color: rgba(55, 179, 183, 1);
|
||||
}
|
||||
|
||||
.calories-progress {
|
||||
border-radius: 16px;
|
||||
background-color: #f8f2ff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 8px !important;
|
||||
}
|
||||
|
||||
.calories-progress-bar {
|
||||
border-radius: 16px;
|
||||
background-color: #51dbd3 !important;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.weight-card {
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 5px 10px 0 rgba(234, 240, 246, 1);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
max-width: 360px;
|
||||
gap: 20px;
|
||||
font-weight: 500;
|
||||
padding: 17px 16px;
|
||||
}
|
||||
|
||||
.weight-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.date {
|
||||
color: #8296c5;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
.weight {
|
||||
color: #384c7f;
|
||||
margin-top: 7px;
|
||||
font: 18px "Poppins", sans-serif;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.weight-details {
|
||||
align-self: start;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #8296c5;
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-weight: 400;
|
||||
align-self: end;
|
||||
}
|
||||
|
||||
.weight-change {
|
||||
display: flex;
|
||||
margin-top: 9px;
|
||||
gap: 9px;
|
||||
color: #f5634a;
|
||||
text-align: right;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.change-value {
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.change-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
align-self: start;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 250px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.consultation-section {
|
||||
margin-top: 55px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.consultation-header {
|
||||
color: #1c2541;
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.consultation-card {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 23px;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
.doctor-info {
|
||||
color: #414d55;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.doctor-name {
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.doctor-email {
|
||||
margin-top: 10px;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.btn .view-result {
|
||||
background-color: #fff;
|
||||
color: #2662f0;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 1px 8px rgba(20, 46, 110, 0.1);
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
max-width: 500px;
|
||||
margin: 1.75rem auto;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
padding: 20px;
|
||||
}
|
||||
@@ -0,0 +1,907 @@
|
||||
body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.vertical-line {
|
||||
width: 2px;
|
||||
height: 180px;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.customer-profile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
max-width: 324px;
|
||||
}
|
||||
|
||||
.profile-image {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
background-color: #a4bbe9;
|
||||
}
|
||||
|
||||
.customer-name {
|
||||
margin-top: 10px;
|
||||
font: 500 18px/100% Poppins, sans-serif;
|
||||
color: #384c7f;
|
||||
}
|
||||
|
||||
.customer-email {
|
||||
font: 400 15px/100% Poppins, sans-serif;
|
||||
color: #8296c5;
|
||||
}
|
||||
|
||||
.customer-stats {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-self: stretch;
|
||||
gap: 20px;
|
||||
margin-top: 15px;
|
||||
padding: 12px 25px;
|
||||
border-radius: 16px;
|
||||
background-color: #384c7f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 8px 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font: 300 12px/117% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.stat-number {
|
||||
font: 500 20px/100% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.stat-unit {
|
||||
font: 300 12px/117% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.obesity-status {
|
||||
width: 100px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.obesity-label {
|
||||
font: 300 12px/117% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.obesity-value {
|
||||
margin-top: 10px;
|
||||
font: 500 16px/87.5% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.boxshadow {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0px 8px 30px 0px rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
/* justify-content: space-between; */
|
||||
padding: 25px 80px 25px 30px;
|
||||
}
|
||||
|
||||
.calories-container {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
align-items: center;
|
||||
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
height: 46px;
|
||||
justify-content: center;
|
||||
margin: auto 0;
|
||||
width: 46px;
|
||||
}
|
||||
|
||||
.icon-wrapper,
|
||||
#calories {
|
||||
background-color: #ffced4;
|
||||
}
|
||||
|
||||
.icon-wrapper,
|
||||
#distance {
|
||||
background-color: #c9ffde;
|
||||
}
|
||||
|
||||
.icon-wrapper,
|
||||
#sleep {
|
||||
background-color: #cee2ff;
|
||||
}
|
||||
|
||||
.calories-icon {
|
||||
fill: #f96577;
|
||||
object-fit: contain;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.calories-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.calories-label {
|
||||
color: #8296c5;
|
||||
font: 400 14px Poppins, sans-serif;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.calories-value {
|
||||
color: #384c7f;
|
||||
font: 500 17px Poppins, sans-serif;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.activity-log {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 680px;
|
||||
font-size: 16px;
|
||||
color: #384c7f;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.activity-header {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 40px;
|
||||
padding: 18px 27px;
|
||||
border-radius: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.activity-header {
|
||||
flex-wrap: wrap;
|
||||
padding: 0 20px;
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.header-date,
|
||||
.header-activity,
|
||||
.header-distance,
|
||||
.header-duration {
|
||||
font-family: Poppins, sans-serif;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.header-activity,
|
||||
.header-distance,
|
||||
.header-duration {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 40px;
|
||||
padding: 18px 25px;
|
||||
border-radius: 12px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0px 8px 30px 0px rgba(37, 36, 34, 0.07);
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.activity-item {
|
||||
flex-wrap: wrap;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-date,
|
||||
.item-activity,
|
||||
.item-distance,
|
||||
.item-duration {
|
||||
font-family: Poppins, sans-serif;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.item-activity,
|
||||
.item-distance,
|
||||
.item-duration {
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.appointment-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 335px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.appointment-time {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding-right: 20px;
|
||||
color: #384c7f;
|
||||
font-weight: 400;
|
||||
line-height: 100%;
|
||||
}
|
||||
|
||||
.appointment-status {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background-color: #37b3b7;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
.appointment-datetime {
|
||||
font-family: Poppins, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.appointment-details {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.appointment-connector {
|
||||
margin: -4px 0 0 5px;
|
||||
border: 1px dashed #a4bbe9;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.doctor-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
flex-grow: 1;
|
||||
flex-basis: 0;
|
||||
width: auto;
|
||||
margin: auto 0;
|
||||
padding: 10px 80px 10px 16px;
|
||||
border: 1px solid #a4bbe9;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.doctor-name {
|
||||
color: #384c7f;
|
||||
font-family: Poppins, sans-serif;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.hospital-name {
|
||||
color: #8296c5;
|
||||
font-family: Poppins, sans-serif;
|
||||
font-weight: 400;
|
||||
line-height: 5px;
|
||||
}
|
||||
|
||||
.content{
|
||||
margin-top: 20px;
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
||||
.calories-description {
|
||||
display: block;
|
||||
font-size: 0.8em;
|
||||
color: #666;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
body{
|
||||
margin-top:20px;
|
||||
background:#f8f8f8
|
||||
}
|
||||
|
||||
.container-notification {
|
||||
background-color: #ffffff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Efect shadow */
|
||||
padding: 10px;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.container-notification a {
|
||||
text-decoration: none; /* Menghapus dekorasi hyperlink */
|
||||
color: #8296c5; /* Warna teks */
|
||||
}
|
||||
.container-notification a:hover {
|
||||
color: #6fffe9; /* Warna teks saat dihover */
|
||||
}
|
||||
.containerContent {
|
||||
background-color: #ffffff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Efect shadow */
|
||||
width: 250px;
|
||||
height: 150px;
|
||||
/* margin-left: 30px;
|
||||
padding: 10px; */
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.full-width-container {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
.containerContent a {
|
||||
text-decoration: none; /* Menghapus dekorasi hyperlink */
|
||||
color: #8296c5; /* Warna teks */
|
||||
}
|
||||
.containeritem {
|
||||
background-color: #ffffff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Efect shadow */
|
||||
margin-left: 30px;
|
||||
padding: 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
width: calc(100% - 120px);
|
||||
}
|
||||
/* Styling untuk item-item */
|
||||
.item {
|
||||
padding-left: 265px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
.main-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 80%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.main-column {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.main-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-self: stretch;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.main-content {
|
||||
max-width: 100%;
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-section {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.payment-section {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.payment-card {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.earning-card {
|
||||
align-items: start;
|
||||
border-radius: 4.444px;
|
||||
border: 1px solid rgba(243, 244, 246, 1);
|
||||
background-color: #6FFFE9;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
padding: 18px 80px 31px 14px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.earning-card {
|
||||
margin-top: 17px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.earning-title {
|
||||
color: var(--text-color-80-opacity, #0B132B);
|
||||
letter-spacing: 0.14px;
|
||||
font: 14px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.earning-amount {
|
||||
color: var(--success-green-100, #0B132B);
|
||||
margin-top: 11px;
|
||||
font: 500 20px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.earning-date {
|
||||
color: var(--Inactive-State-Color, #0B132B);
|
||||
letter-spacing: 0.09px;
|
||||
margin-top: 11px;
|
||||
font: 9px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.pending-card {
|
||||
align-items: start;
|
||||
border-radius: 4.444px;
|
||||
border: 1px solid rgba(243, 244, 246, 1);
|
||||
background-color: #0B132B;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
padding: 18px 80px 31px 15px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.pending-card {
|
||||
margin-top: 17px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-body{
|
||||
width: 100%;
|
||||
}
|
||||
.card-full-width {
|
||||
width: 100%;
|
||||
}
|
||||
.pending-title {
|
||||
color: var(--text-color-80-opacity, #6FFFE9);
|
||||
letter-spacing: 0.14px;
|
||||
font: 14px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.pending-amount {
|
||||
color: var(--success-green-100, #2662F0);
|
||||
margin-top: 11px;
|
||||
font: 500 20px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.pending-date {
|
||||
color: var(--Inactive-State-Color,#6FFFE9);
|
||||
letter-spacing: 0.09px;
|
||||
margin-top: 11px;
|
||||
font: 9px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
.payment-title {
|
||||
color: var(--Inactive-State-Color, rgba(73, 69, 79, 0.8));
|
||||
margin-top: 33px;
|
||||
font: 500 20px Outfit, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.payment-title {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
.entry-accept {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 15px 26px;
|
||||
flex: 1;
|
||||
font-family: Poppins, sans-serif;
|
||||
border-radius: 50px;
|
||||
color:#15647A;
|
||||
background-color: #51DBD3;
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.entry-decline {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 15px 26px;
|
||||
flex: 1;
|
||||
font-family: Poppins, sans-serif;
|
||||
border-radius: 50px;
|
||||
color:#CC2A2A;
|
||||
background-color: #F7B8C5;
|
||||
height: 30px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
margin-top: 24px;
|
||||
width: 595px;
|
||||
gap: 17px;
|
||||
font-size: 15px;
|
||||
color: var(--text-color-80-opacity, rgba(34, 34, 34, 0.9));
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.15px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.tab-container {
|
||||
flex-wrap: wrap;
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.tab {
|
||||
border-radius: 26.667px;
|
||||
border: 1px solid rgba(65, 59, 137, 1);
|
||||
background-color: var(--Secondary---White, #fff);
|
||||
justify-content: center;
|
||||
padding: 15px;
|
||||
font-variant-numeric: lining-nums proportional-nums;
|
||||
font-feature-settings: "dlig" on;
|
||||
font-family: Outfit, sans-serif;
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tab {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.tab {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-small {
|
||||
border-radius: 26.667px;
|
||||
border: 1px solid rgba(235, 235, 238, 1);
|
||||
background-color: var(--Secondary---White, #fff);
|
||||
justify-content: center;
|
||||
padding: 17px 23px;
|
||||
font-variant-numeric: lining-nums proportional-nums;
|
||||
font-feature-settings: "dlig" on;
|
||||
font-family: Outfit, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.tab-small {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-medium {
|
||||
border-radius: 26.667px;
|
||||
border: 1px solid rgba(235, 235, 238, 1);
|
||||
background-color: var(--Secondary---White, #fff);
|
||||
justify-content: center;
|
||||
padding: 17px 28px;
|
||||
font-variant-numeric: lining-nums proportional-nums;
|
||||
font-feature-settings: "dlig" on;
|
||||
font-family: Outfit, sans-serif;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.tab-medium {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-large {
|
||||
border-radius: 26.667px;
|
||||
border: 1px solid rgba(235, 235, 238, 1);
|
||||
background-color: var(--Secondary---White, #fff);
|
||||
justify-content: center;
|
||||
padding: 17px 26px;
|
||||
font-variant-numeric: lining-nums proportional-nums;
|
||||
font-feature-settings: "dlig" on;
|
||||
font-family: Outfit, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.tab-large {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-history {
|
||||
border-radius: 10.667px;
|
||||
border: 1px solid rgba(235, 235, 238, 1);
|
||||
background-color: var(--Secondary---White, #fff);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
padding: 0 28px 33px 0;
|
||||
margin-top: 16px;
|
||||
margin-bottom: 10px;
|
||||
width: 1150px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.payment-history {
|
||||
max-width: 100%;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.history-header,
|
||||
.history-body {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(206, 206, 206, 1);
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.history-header {
|
||||
letter-spacing: 0.14px;
|
||||
padding-right: 68px;
|
||||
width: 1150px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.history-header {
|
||||
flex-wrap: wrap;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.history-column,
|
||||
.history-entry {
|
||||
padding: 20px 0;
|
||||
text-align: center;
|
||||
font-family: Outfit, sans-serif;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.history-column {
|
||||
font-variant-numeric: lining-nums proportional-nums;
|
||||
font-feature-settings: "dlig" on;
|
||||
color: var(--Inactive-State-Color, rgba(73, 69, 79, 0.8));
|
||||
}
|
||||
|
||||
.history-body {
|
||||
color: rgba(73, 69, 79, 0.9);
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.14px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.history-body {
|
||||
white-space: initial;
|
||||
grid-template-columns: 1fr;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.status-success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.status-rejected {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.entry-detail,
|
||||
.entry-pay{
|
||||
background-color: #f0f0f0;
|
||||
border: none;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.history-entry-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.history-entry {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
word-wrap: break-word;
|
||||
letter-spacing: 0.14px;
|
||||
padding: 20px 21px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.history-entry {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.entry-detail {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 15px 26px;
|
||||
flex: 1;
|
||||
margin-top: 15px;
|
||||
font-family: Poppins, sans-serif;
|
||||
border-radius: 50px;
|
||||
color: white;
|
||||
background-color: #0978f2;
|
||||
height: 30px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.entry-pay {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 15px 26px;
|
||||
flex: 1;
|
||||
margin-top: 15px;
|
||||
font-family: Poppins, sans-serif;
|
||||
border-radius: 50px;
|
||||
color: white;
|
||||
background-color: #0EAD69;
|
||||
height: 30px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.entry-detail {
|
||||
white-space: initial;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.status-success {
|
||||
color: #0ead69;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
color: #0978f2;
|
||||
}
|
||||
|
||||
.status-rejected {
|
||||
color: rgba(193, 11, 14, 0.8);
|
||||
}
|
||||
|
||||
.status-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: 5px;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
line-height: 540%;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.status-container {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.rows-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.rows-center img {
|
||||
border-radius: 3.368px;
|
||||
}
|
||||
.change-photo-span {
|
||||
font-size: 12px; /* Adjust the font size as needed */
|
||||
}
|
||||
|
||||
.card-container {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0px 8px 30px 0px rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
max-width: 350px;
|
||||
flex-direction: column;
|
||||
padding: 50px 22px 31px;
|
||||
}
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 16px;
|
||||
font-size: 14px;
|
||||
color: #435179;
|
||||
font-weight: 400;
|
||||
}
|
||||
.profile-pic {
|
||||
background-color: #51dbd3;
|
||||
border-radius: 50%;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.details {
|
||||
display: flex;
|
||||
margin-top: 20px;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
flex-basis: 0;
|
||||
width: fit-content;
|
||||
}
|
||||
.hospital-name {
|
||||
color: #1c2541;
|
||||
font: 500 20px Poppins, sans-serif;
|
||||
}
|
||||
.date-info {
|
||||
margin-top: 9px;
|
||||
font: 16px Poppins, sans-serif;
|
||||
}
|
||||
.doctor-name,
|
||||
.status,
|
||||
.time-info {
|
||||
font-family: Poppins, sans-serif;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.action-button {
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background-color: #2662f0;
|
||||
align-self: end;
|
||||
margin-top: 25px;
|
||||
color: #fff;
|
||||
white-space: nowrap;
|
||||
padding: 17px 39px;
|
||||
font: 500 15px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.status{
|
||||
color: #2662f0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,733 @@
|
||||
body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.admin-dashboard-title {
|
||||
color: #1c2541;
|
||||
text-align: center;
|
||||
align-self: start;
|
||||
font: 500 32px Poppins, sans-serif;
|
||||
}
|
||||
.patients-summary {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0px 8px 30px 0px rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 30px 77px 30px 30px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.patients-summary {
|
||||
max-width: 100%;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 265px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.header{
|
||||
padding-left: 265px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.patients-summary-title {
|
||||
color: #384c7f;
|
||||
letter-spacing: 0.4px;
|
||||
font: 500 20px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.patients-summary-content {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.patients-summary-row {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.patients-summary-row {
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.patients-summary-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 24%;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.patients-summary-column {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.gender-stats {
|
||||
display: flex;
|
||||
margin-top: 22px;
|
||||
flex-grow: 1;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.gender-stats {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.gender-icons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.male-icon,
|
||||
.female-icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10px;
|
||||
background-color: #cfddff;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
padding: 0 19px;
|
||||
}
|
||||
|
||||
.female-icon {
|
||||
margin-top: 21px;
|
||||
}
|
||||
|
||||
.gender-icon {
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
.gender-labels {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
color: #8296c5;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.28px;
|
||||
flex: 1;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.gender-labels {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.gender-label {
|
||||
font-family: Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.gender-count {
|
||||
color: #1c2541;
|
||||
letter-spacing: 0.4px;
|
||||
margin-top: 13px;
|
||||
font: 500 20px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.female-label {
|
||||
margin-top: 33px;
|
||||
}
|
||||
|
||||
.bmi-stats {
|
||||
display: flex;
|
||||
margin-top: 23px;
|
||||
flex-grow: 1;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.bmi-stats {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.bmi-icons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.normal-icon,
|
||||
.obesity-icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.normal-icon {
|
||||
background-color: #b7ffe9;
|
||||
}
|
||||
|
||||
.obesity-icon {
|
||||
background-color: #ffb8c9;
|
||||
margin-top: 21px;
|
||||
}
|
||||
|
||||
.bmi-icon {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.bmi-labels {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
color: #8296c5;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.28px;
|
||||
flex: 1;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.bmi-labels {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.bmi-label {
|
||||
font-family: Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.bmi-count {
|
||||
color: #1c2541;
|
||||
letter-spacing: 0.4px;
|
||||
margin-top: 13px;
|
||||
font: 500 20px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.obesity-label {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.obesity-count {
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
.chart-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 52%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.chart-column {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
gap: 17px;
|
||||
font-size: 12px;
|
||||
color: #6c7588;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.24px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.chart-container {
|
||||
margin-top: 40px;
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-image {
|
||||
width: 140px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.chart-legend {
|
||||
align-self: start;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.chart-legend {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
color: #384c7f;
|
||||
letter-spacing: 0.4px;
|
||||
align-self: stretch;
|
||||
font: 500 20px Poppins, sans-serif;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: flex;
|
||||
width: 60px;
|
||||
gap: 8px;
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
.obesity-legend {
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.normal-legend {
|
||||
margin-top: 5px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.legend-color {
|
||||
border-radius: 50%;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.obesity-color {
|
||||
background-color: #f45d78;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
.normal-color {
|
||||
background-color: #5df4c7;
|
||||
}
|
||||
|
||||
.legend-label {
|
||||
font-family: Nunito Sans, sans-serif;
|
||||
}
|
||||
|
||||
.doctor-total-card {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 30px 0 rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.doctor-total-header {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
color: #8296c5;
|
||||
font: 400 16px/150% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.doctor-total-icon {
|
||||
width: 22px;
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
.doctor-total-label {
|
||||
font-family: Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.doctor-total-value {
|
||||
margin-top: 10px;
|
||||
color: #1c2541;
|
||||
font: 500 30px/80% Poppins, sans-serif;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.user-roles {
|
||||
border-radius: 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
margin-top: 21px;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 25px 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.user-roles {
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-roles-header {
|
||||
align-self: stretch;
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
font-size: 16px;
|
||||
color: #0c1e5b;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.32px;
|
||||
justify-content: space-between;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.user-roles-title {
|
||||
font-family: Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.user-roles-icon {
|
||||
aspect-ratio: 3.57;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
width: 18px;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.user-roles-image {
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
width: 140px;
|
||||
margin-top: 28px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.user-roles-legend {
|
||||
display: flex;
|
||||
margin-top: 28px;
|
||||
gap: 20px;
|
||||
font-size: 12px;
|
||||
color: #6c7588;
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.24px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.user-roles-legend {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.user-role {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.user-role {
|
||||
white-space: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.user-role-indicator {
|
||||
border-radius: 50%;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.user-role-indicator.patient {
|
||||
background-color: #5df4c7;
|
||||
}
|
||||
|
||||
.user-role-indicator.admin {
|
||||
background-color: #f45d78;
|
||||
}
|
||||
|
||||
.user-role-indicator.doctor {
|
||||
background-color: #8db3ff;
|
||||
}
|
||||
|
||||
.user-role-label {
|
||||
font-family: Nunito Sans, sans-serif;
|
||||
}
|
||||
|
||||
.patient-total-card {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 30px 0 rgba(37, 36, 34, 0.07);
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.patient-total-header {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
color: #8296c5;
|
||||
font: 400 16px/150% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.patient-icon {
|
||||
width: 24px;
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.patient-total-label {
|
||||
font-family: Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.patient-total-value {
|
||||
margin-top: 10px;
|
||||
color: #1c2541;
|
||||
font: 500 30px/80% Poppins, sans-serif;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.notification-container {
|
||||
border-radius: 20px;
|
||||
background-color: #fff;
|
||||
max-width: 830px;
|
||||
margin-top: 17px;
|
||||
padding: 25px 28px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-container {
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-content {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-content {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 80%;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-details {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-header {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-header {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-icon {
|
||||
aspect-ratio: 1;
|
||||
object-fit: auto;
|
||||
object-position: center;
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.notification-text {
|
||||
align-self: start;
|
||||
display: flex;
|
||||
margin-top: 6px;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
flex-basis: 0;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.notification-title {
|
||||
color: #0c1e5b;
|
||||
letter-spacing: 0.32px;
|
||||
font: 600 16px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.notification-description {
|
||||
color: #888fa7;
|
||||
letter-spacing: 0.26px;
|
||||
margin-top: 12px;
|
||||
font: 400 13px/154% Poppins, sans-serif;
|
||||
}
|
||||
|
||||
.notification-action {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: normal;
|
||||
width: 20%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-action {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-button {
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background-color: #384c7f;
|
||||
align-self: stretch;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
letter-spacing: 0.28px;
|
||||
width: 100%;
|
||||
margin: auto 0;
|
||||
padding: 8px 16px;
|
||||
font: 500 14px Poppins, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.notification-button {
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.image-notif{
|
||||
width:100%;
|
||||
padding:15px;
|
||||
}
|
||||
|
||||
|
||||
.image {
|
||||
width: 10%;
|
||||
aspect-ratio: 1.14;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
|
||||
.container-patient{
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
gap: 17px;
|
||||
font-size: 12px;
|
||||
background-color: #ffff;
|
||||
color: #6c7588;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.24px;
|
||||
padding: 25px 25px 25px 25px;
|
||||
|
||||
}
|
||||
|
||||
.container-patient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
max-width: 100%; /* Lebar maksimum tabel */
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Efek bayangan */
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 250px) auto; /* Menggunakan grid untuk header */
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.header-cell {
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table-image {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.page-number,
|
||||
.previous-button,
|
||||
.next-button {
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.active-page {
|
||||
background-color: #007bff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.change-photo-span {
|
||||
font-size: 12px; /* Adjust the font size as needed */
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-body{
|
||||
width: 100%;
|
||||
}
|
||||
.card-full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content{
|
||||
margin-top: 20px;
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 250px;
|
||||
flex: 1;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.patient-list {
|
||||
margin: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-recommendation {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal-title span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user