This commit is contained in:
commit
a43fe06080
|
@ -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,90 @@
|
|||
APP_NAME=Laravel
|
||||
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
|
||||
|
||||
PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
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=spk_pm_dosbing
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
# PUSHER_APP_ID=1944527
|
||||
# PUSHER_APP_KEY=6a84a71e1b473120450c
|
||||
# PUSHER_APP_SECRET=e65278939c6516ea0ef2
|
||||
# PUSHER_HOST=
|
||||
# PUSHER_PORT=443
|
||||
# PUSHER_SCHEME="https"
|
||||
# PUSHER_APP_CLUSTER="mt1"
|
||||
|
||||
CACHE_STORE=database
|
||||
CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
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}"
|
||||
|
||||
GOOGLE_CLIENT_ID=
|
||||
GOOGLE_CLIENT_SECRET=
|
||||
GOOGLE_REDIRECT_URI=
|
||||
|
||||
REVERB_APP_ID=
|
||||
REVERB_APP_KEY=
|
||||
REVERB_APP_SECRET=
|
||||
REVERB_HOST=
|
||||
REVERB_PORT=
|
||||
REVERB_SCHEME=
|
||||
|
||||
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
|
||||
VITE_REVERB_HOST="${REVERB_HOST}"
|
||||
VITE_REVERB_PORT="${REVERB_PORT}"
|
||||
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
|
|
@ -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
|
|
@ -0,0 +1,42 @@
|
|||
name: SPK_PM_DOSBING
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
jobs:
|
||||
deploy:
|
||||
name: deploy to staging
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
|
||||
with:
|
||||
php-version: "8.2"
|
||||
- uses: actions/checkout@v4
|
||||
- name: Copy .env
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Install Dependencies
|
||||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-dev --optimize-autoloader --no-interaction --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.mysql
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
cache: "npm"
|
||||
- name: Install Dependencies & Build
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
- name: 📂 Sync files
|
||||
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
|
||||
with:
|
||||
server: ${{ secrets.ftp_servername }}
|
||||
username: ${{ secrets.ftp_username }}
|
||||
password: ${{ secrets.ftp_password }}
|
|
@ -0,0 +1,21 @@
|
|||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
tailwind.config copy.js
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
|
@ -0,0 +1,66 @@
|
|||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel 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>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[WebReinvent](https://webreinvent.com/)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Jump24](https://jump24.co.uk)**
|
||||
- **[Redberry](https://redberry.international/laravel/)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
- **[byte5](https://byte5.de)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AlternatifUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $alternatif;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct($alternatif)
|
||||
{
|
||||
$this->alternatif = $alternatif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('update-value'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class KuotaUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $subkriteria;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct($subkriteria)
|
||||
{
|
||||
$this->subkriteria = $subkriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new Channel('kuota-channel'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\SubmissionDetail;
|
||||
use App\Models\Submissions;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SubmissionCreated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $submission;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(SubmissionDetail $submission)
|
||||
{
|
||||
$this->submission = $submission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('channel-name'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class FormatHelper
|
||||
{
|
||||
public static function formatPersentase($value)
|
||||
{
|
||||
return (float) str_replace(',', '.', str_replace('%', '', $value));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Alternatif\AlternatifRequest;
|
||||
use App\Models\Alternatif;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AlternatifController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['alternatif'] = Alternatif::all();
|
||||
|
||||
return view('pages.alternatif.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('pages.alternatif.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(AlternatifRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Alternatif::create($validated);
|
||||
|
||||
return redirect()->route('alternatif.index')->with('success', 'Data Berhasil Ditambah');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menambahkan Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
$data['alternatif'] = Alternatif::find($id);
|
||||
|
||||
return view('pages.alternatif.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(AlternatifRequest $request, string $id)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Alternatif::find($id)->update($validated);
|
||||
|
||||
return redirect()->route('alternatif.index')->with('success', 'Data Berhasil Diperbarui');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return back()->with(['error' => 'Gagal Mengubah Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
try {
|
||||
Alternatif::find($id)->delete();
|
||||
return redirect()->route('alternatif.index')->with('success', 'Data Berhasil Dihapus');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menghapus Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Alternatif;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AlternatifController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Aspek;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\AspekResource;
|
||||
use App\Models\Aspek;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AspekController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$limit = $request->limit ?? 10;
|
||||
|
||||
$kriteria = Aspek::paginate($limit);
|
||||
|
||||
return new AspekResource($kriteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Kriteria;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\KriteriaResource;
|
||||
use App\Models\Kriteria;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class KriteriaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$limit = $request->limit ?? 10;
|
||||
|
||||
$kriteria = Kriteria::where('id_aspek', '!=', 1)->with('subkriteria')->paginate($limit);
|
||||
|
||||
return new KriteriaResource($kriteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\ProfileMatching;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ProfileMatching\ProfileMatchingRequest;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Aspek;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\Subkriteria;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProfileMatchingController extends Controller
|
||||
{
|
||||
public function handleProfileMatching(ProfileMatchingRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$data['judul'] = $request->input('judul');
|
||||
$data['deskripsi'] = $request->input('deskripsi');
|
||||
$selectedKriteria = $request->input('kriteria', []);
|
||||
$selectedAlternatif = $request->input('alternatif', []);
|
||||
|
||||
if (empty($selectedKriteria) || empty($selectedAlternatif)) {
|
||||
return back()->withErrors('Kriteria dan alternatif harus dipilih.')->withInput();
|
||||
}
|
||||
|
||||
Log::info('Selected Kriteria:', ['data' => $selectedKriteria]);
|
||||
Log::info('Selected Alternatif:', ['data' => $selectedAlternatif]);
|
||||
|
||||
$data['resultsGAP'] = $this->gapProfil($selectedAlternatif, $selectedKriteria);
|
||||
$data['normalizedGAP'] = $this->normalizeGAP($data['resultsGAP']);
|
||||
$data['factorValue'] = $this->factorValue($data['normalizedGAP']);
|
||||
$data['totalValue'] = $this->totalValue($data['factorValue']);
|
||||
$data['ranking'] = $this->rankAlternatif($data['totalValue']);
|
||||
|
||||
$data['data_aspek'] = Aspek::all();
|
||||
$data['data_kriteria'] = Kriteria::all();
|
||||
|
||||
if (empty($data['resultsGAP']) || empty($data['ranking'])) {
|
||||
return back()->withErrors('Terjadi kesalahan saat memproses data.')->withInput();
|
||||
}
|
||||
|
||||
// dd($data);
|
||||
return view('profile-matching.result', $data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error in Profile Matching:', ['message' => $e->getMessage()]);
|
||||
|
||||
return response()->json(['error' => 'Terjadi kesalahan saat memproses data: ' . $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function gapProfil($alternatif, $kriteria)
|
||||
{
|
||||
$resultsGAP = [];
|
||||
$gapValues = [];
|
||||
|
||||
$dosenProfile = ProfileMethod::with('kriteria', 'subkriteria')->whereIn('id_alternatif', $alternatif)->get();
|
||||
|
||||
foreach ($dosenProfile as $dosen) {
|
||||
|
||||
$dosenSubkriteria = $dosen->subkriteria;
|
||||
$dosenKriteria = $dosen->kriteria;
|
||||
|
||||
foreach ($kriteria as $key => $subkriteriaId) {
|
||||
$idealValue = Subkriteria::with('kriteria')->find($subkriteriaId);
|
||||
$idealKriteria = $idealValue->kriteria;
|
||||
|
||||
if ($dosenKriteria->id_kriteria == $idealKriteria->id_kriteria) {
|
||||
$gapValues[$idealValue->id_kriteria] = $dosenSubkriteria->nilai - $idealValue->nilai;
|
||||
}
|
||||
}
|
||||
|
||||
$resultsGAP[$dosen->id_alternatif] = $gapValues;
|
||||
}
|
||||
Log::info('Ideal Value:', ['data' => $idealValue]);
|
||||
Log::info('GAP Values:', ['dosenId' => $dosen->id_alternatif, 'gapValues' => $gapValues]);
|
||||
|
||||
return $resultsGAP;
|
||||
}
|
||||
|
||||
private function normalizeGAP($resultsGAP)
|
||||
{
|
||||
$normalizedGAP = [];
|
||||
$normalizedValues = [];
|
||||
$conversionTable = [
|
||||
0 => 5,
|
||||
1 => 4.5,
|
||||
-1 => 4,
|
||||
2 => 3.5,
|
||||
-2 => 3,
|
||||
3 => 2.5,
|
||||
-3 => 2,
|
||||
4 => 1.5,
|
||||
-4 => 1
|
||||
];
|
||||
|
||||
foreach ($resultsGAP as $dosenId => $gapValues) {
|
||||
|
||||
foreach ($gapValues as $key => $gap) {
|
||||
$normalizedValues[$key] = $conversionTable[$gap] ?? 1;
|
||||
}
|
||||
|
||||
$normalizedGAP[$dosenId] = $normalizedValues;
|
||||
}
|
||||
|
||||
return $normalizedGAP;
|
||||
}
|
||||
|
||||
private function factorValue($normalizedGAP) {
|
||||
$resultsFactor = [];
|
||||
|
||||
foreach ($normalizedGAP as $dosenId => $gapValues) {
|
||||
$dataAspek = Aspek::all();
|
||||
$aspek = [];
|
||||
|
||||
foreach ($dataAspek as $aspekValue) {
|
||||
$aspekId = $aspekValue->id_aspek;
|
||||
|
||||
$coreValues = 0;
|
||||
$secondaryValues = 0;
|
||||
$coreCount = 0;
|
||||
$secondaryCount = 0;
|
||||
$factorValue = [];
|
||||
|
||||
foreach ($gapValues as $kriteria => $values) {
|
||||
$factor = Kriteria::find($kriteria);
|
||||
|
||||
if ($factor->tipe == 'Core Factor') {
|
||||
if ($aspekId == $factor->id_aspek) {
|
||||
$coreValues += $values;
|
||||
$coreCount++;
|
||||
}
|
||||
} else {
|
||||
if ($aspekId == $factor->id_aspek) {
|
||||
$secondaryValues += $values;
|
||||
$secondaryCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($coreCount > 0) {
|
||||
$factorValue['NCF'] = $coreValues / $coreCount;
|
||||
}
|
||||
if ($secondaryCount > 0) {
|
||||
$factorValue['NSF'] = $secondaryValues / $secondaryCount;
|
||||
}
|
||||
|
||||
$aspek[$aspekId] = $factorValue;
|
||||
}
|
||||
$resultsFactor[$dosenId] = $aspek;
|
||||
}
|
||||
|
||||
return $resultsFactor;
|
||||
}
|
||||
|
||||
private function totalValue($factorValue)
|
||||
{
|
||||
$totalValues = [];
|
||||
$aspek = [];
|
||||
$totalValueFactor = [];
|
||||
$bobotCF = 60;
|
||||
$bobotSF = 40;
|
||||
|
||||
foreach ($factorValue as $dosenId => $value) {
|
||||
foreach ($value as $aspekId => $values) {
|
||||
$value = [];
|
||||
|
||||
foreach ($values as $tipeValue => $valueFactor) {
|
||||
if ($tipeValue == 'NCF') {
|
||||
$value[] = $valueFactor * $bobotCF / 100;
|
||||
} else {
|
||||
$value[] = $valueFactor * $bobotSF / 100;
|
||||
}
|
||||
}
|
||||
$totalValueFactor = array_sum($value);
|
||||
$aspek[$aspekId] = $totalValueFactor;
|
||||
}
|
||||
$totalValues[$dosenId] = $aspek;
|
||||
}
|
||||
|
||||
return $totalValues;
|
||||
}
|
||||
|
||||
private function rankAlternatif($totalValues)
|
||||
{
|
||||
$rankedResults = [];
|
||||
|
||||
foreach ($totalValues as $dosenId => $totalValue) {
|
||||
$ha = 0;
|
||||
|
||||
foreach ($totalValue as $aspekId => $value) {
|
||||
$bobotAspek = Aspek::where('id_aspek', $aspekId)->pluck('persentase')->first();
|
||||
if ($bobotAspek) {
|
||||
$ha += $value * ($bobotAspek / 100);
|
||||
}
|
||||
}
|
||||
$alternatif = Alternatif::where('id_alternatif', $dosenId)->first();
|
||||
|
||||
$rankedResults[] = [
|
||||
'dosenId' => $alternatif->id_alternatif,
|
||||
'dosenName' => $alternatif->name,
|
||||
'hasilAkhir' => $ha,
|
||||
];
|
||||
}
|
||||
|
||||
usort($rankedResults, function ($a, $b) {
|
||||
return $b['hasilAkhir'] <=> $a['hasilAkhir'];
|
||||
});
|
||||
|
||||
foreach ($rankedResults as $index => &$result) {
|
||||
$result['rank'] = $index + 1;
|
||||
}
|
||||
|
||||
return $rankedResults;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\ProfileMethod;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ProfileMethod as ModelsProfileMethod;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProfileMethod extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$limit = $request->limit ?? 10;
|
||||
|
||||
$alternatif = ModelsProfileMethod::with('subkriteria')->paginate($limit);
|
||||
|
||||
return new kriteriaResource($kriteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\ProfileMethod;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\ProfileMethodResource;
|
||||
use App\Models\ProfileMethod;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProfileMethodController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$limit = $request->limit ?? 10;
|
||||
|
||||
$profile = ProfileMethod::with('alternatif', 'kriteria', 'subkriteria')->paginate($limit);
|
||||
|
||||
return new ProfileMethodResource($profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\FormatHelper;
|
||||
use App\Http\Requests\Aspek\AspekCreateRequest;
|
||||
use App\Models\Aspek;
|
||||
use Illuminate\Routing\Controllers\Middleware;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AspekController extends Controller
|
||||
{
|
||||
public static function middleware(): array
|
||||
{
|
||||
return [
|
||||
new Middleware('permission:aspek-read', only: ['index']),
|
||||
new Middleware('permission:aspek-create', only: ['create', 'store']),
|
||||
new Middleware('permission:aspek-update', only: ['edit', 'update']),
|
||||
new Middleware('permission:aspek-delete', only: ['destroy']),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['aspek'] = Aspek::all();
|
||||
return view('pages.aspek.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('pages.aspek.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(AspekCreateRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$validated['persentase'] = FormatHelper::formatPersentase($validated['persentase']);
|
||||
|
||||
Aspek::create($validated);
|
||||
|
||||
return redirect()->route('aspek.index')->with('success', 'Data Berhasil Ditambah');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menambahkan Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
$data['aspek'] = Aspek::find($id);
|
||||
|
||||
return view('pages.aspek.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
$data['aspek'] = Aspek::find($id);
|
||||
|
||||
return view('pages.aspek.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(AspekCreateRequest $request, string $id)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$validated['persentase'] = FormatHelper::formatPersentase($validated['persentase']);
|
||||
|
||||
Aspek::find($id)->update($validated);
|
||||
|
||||
return redirect()->route('aspek.index')->with('success', 'Data Berhasil Diperbarui');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return back()->with(['error' => 'Gagal Mengubah Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
try {
|
||||
Aspek::find($id)->delete();
|
||||
return redirect()->route('aspek.index')->with('success', 'Data Berhasil Dihapus');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menghapus Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?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;
|
||||
|
||||
class AuthenticatedSessionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the login view.
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('pages.auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming authentication request.
|
||||
*/
|
||||
public function store(LoginRequest $request): RedirectResponse
|
||||
{
|
||||
$request->authenticate();
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->intended(route('dashboard.index', absolute: false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an authenticated session.
|
||||
*/
|
||||
public function destroy(Request $request): RedirectResponse
|
||||
{
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
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('pages.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.index', 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.index', 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.index', absolute: false))
|
||||
: view('pages.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('pages.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('pages.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,52 @@
|
|||
<?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('pages.auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming registration request.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
|
||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'name' => $request->name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
$user->assignRole('mahasiswa');
|
||||
|
||||
Auth::login($user);
|
||||
|
||||
return redirect(route('dashboard.index', absolute: false));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth\ThirdParty\Google;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Exception;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
||||
class GoogleController extends Controller
|
||||
{
|
||||
public function redirectToGoogle(): RedirectResponse
|
||||
{
|
||||
return Socialite::driver('google')->redirect();
|
||||
}
|
||||
|
||||
public function handleGoogleCallback(): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$socialUser = Socialite::driver('google')->user();
|
||||
|
||||
$existingGoogleUser = User::where('google_id', $socialUser->id)->first();
|
||||
|
||||
if ($existingGoogleUser) {
|
||||
Auth::login($existingGoogleUser);
|
||||
} else {
|
||||
$existingEmailUser = User::where('email', $socialUser->email)->first();
|
||||
|
||||
if ($existingEmailUser) {
|
||||
$existingEmailUser->google_id = $socialUser->id;
|
||||
$existingEmailUser->save();
|
||||
|
||||
Auth::login($existingEmailUser);
|
||||
} else {
|
||||
$username = $socialUser->nickname ?: strtolower(str_replace(' ', '', $socialUser->name)) . rand(100, 999);
|
||||
|
||||
$newUser = User::create([
|
||||
'username' => $username,
|
||||
'name' => $socialUser->name,
|
||||
'email' => $socialUser->email,
|
||||
'google_id' => $socialUser->id,
|
||||
'password' => Hash::make(Str::random(16)),
|
||||
]);
|
||||
|
||||
event(new Registered($newUser));
|
||||
|
||||
$newUser->assignRole('mahasiswa');
|
||||
|
||||
Auth::login($newUser);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('dashboard');
|
||||
} catch (Exception $e) {
|
||||
Log::error('Google Login Error', ['message' => $e->getMessage()]);
|
||||
|
||||
return redirect()->route('login')->with([
|
||||
'error' => 'Login with Google failed. Please refresh and try again.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.index', absolute: false).'?verified=1');
|
||||
}
|
||||
|
||||
if ($request->user()->markEmailAsVerified()) {
|
||||
event(new Verified($request->user()));
|
||||
}
|
||||
|
||||
return redirect()->intended(route('dashboard.index', absolute: false).'?verified=1');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Submissions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['alternatif'] = Alternatif::all();
|
||||
$data['jumlah_alternatif'] = Alternatif::count();
|
||||
$data['jumlah_mahasiswa'] = Role::where('name', 'mahasiswa')
|
||||
->first()
|
||||
->users()
|
||||
->count();
|
||||
$data['jumlah_pengajuan'] = Submissions::count();
|
||||
|
||||
return view('pages.dashboard.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Kriteria\KriteriaRequest;
|
||||
use App\Models\Aspek;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Subkriteria;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class KriteriaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['kriteria'] = Kriteria::all();
|
||||
|
||||
return view('pages.kriteria.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['aspek'] = Aspek::all();
|
||||
return view('pages.kriteria.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(KriteriaRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Kriteria::create($validated);
|
||||
|
||||
return redirect()->route('kriteria.index')->with('success', 'Data Berhasil Ditambah');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menambahkan Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
$data['kriteria'] = Kriteria::find($id);
|
||||
$data['aspek'] = Aspek::all();
|
||||
$data['subkriteria'] = Subkriteria::with('kriteria')->where('id_kriteria', $id)->get();
|
||||
|
||||
return view('pages.kriteria.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
$data['kriteria'] = Kriteria::find($id);
|
||||
$data['aspek'] = Aspek::all();
|
||||
$data['subkriteria'] = Subkriteria::with('kriteria')->where('id_kriteria', $id)->get();
|
||||
|
||||
return view('pages.kriteria.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(KriteriaRequest $request, string $id)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Kriteria::find($id)->update($validated);
|
||||
|
||||
return redirect()->route('kriteria.index')->with('success', 'Data Berhasil Diperbarui');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return back()->with(['error' => 'Gagal Mengubah Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
try {
|
||||
Kriteria::find($id)->delete();
|
||||
return redirect()->route('kriteria.index')->with('success', 'Data Berhasil Dihapus');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menghapus Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MahasiswaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['mahasiswa'] = User::role('mahasiswa')->get();
|
||||
|
||||
return view('pages.mahasiswa.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ProfileUpdateRequest;
|
||||
use App\Models\Angkatan;
|
||||
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(),
|
||||
'angkatan' => Angkatan::all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,287 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ProfileMatching\ProfileMatchingRequest;
|
||||
use App\Http\Requests\Submission\SubmissionRequest;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Aspek;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\Subkriteria;
|
||||
use App\Models\Submissions;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProfileMatchingController extends Controller
|
||||
{
|
||||
public function handleProfileMatching(ProfileMatchingRequest $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$subkriteria1 = ProfileMethod::where('id_kriteria', 1)
|
||||
->pluck('id_subkriteria')
|
||||
->toArray();
|
||||
|
||||
// $subkriteria2 = ProfileMethod::where('id_kriteria', 2)
|
||||
// ->pluck('id_subkriteria')
|
||||
// ->toArray();
|
||||
|
||||
$countSubkriteria1 = array_count_values($subkriteria1);
|
||||
// $countSubkriteria2 = array_count_values($subkriteria2);
|
||||
|
||||
$mostKriteria1 = array_search(max($countSubkriteria1), $countSubkriteria1);
|
||||
// $mostKriteria2 = array_search(max($countSubkriteria2), $countSubkriteria2);
|
||||
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$selectKriteria = $request->input('kriteria', []);
|
||||
$selectedAlternatif = $request->input('alternatif', []);
|
||||
|
||||
$selectKriteria = array_merge([$mostKriteria1, 7], $selectKriteria);
|
||||
$selectedKriteria = $selectKriteria;
|
||||
|
||||
$selectedKriteria = array_map(function ($item) {
|
||||
return (string) $item;
|
||||
}, $selectedKriteria);
|
||||
|
||||
if (empty($selectedKriteria) || empty($selectedAlternatif)) {
|
||||
return back()->withErrors('Kriteria dan alternatif harus dipilih.')->withInput();
|
||||
}
|
||||
|
||||
Log::info('Selected Kriteria:', ['data' => $selectedKriteria]);
|
||||
Log::info('Selected Alternatif:', ['data' => $selectedAlternatif]);
|
||||
|
||||
$data['selectedKriteria'] = $selectedKriteria;
|
||||
$data['resultsGAP'] = $this->gapProfil($selectedAlternatif, $selectedKriteria);
|
||||
$data['normalizedGAP'] = $this->normalizeGAP($data['resultsGAP']);
|
||||
$data['factorValue'] = $this->factorValue($data['normalizedGAP']);
|
||||
$data['totalValue'] = $this->totalValue($data['factorValue']);
|
||||
$data['ranking'] = $this->rankAlternatif($data['totalValue']);
|
||||
|
||||
$data['data_aspek'] = Aspek::all();
|
||||
$data['data_kriteria'] = Kriteria::all();
|
||||
|
||||
if (empty($data['resultsGAP']) || empty($data['ranking'])) {
|
||||
return back()->withErrors('Terjadi kesalahan saat memproses data.')->withInput();
|
||||
}
|
||||
|
||||
return view('profile-matching.result', $data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error in Profile Matching:', ['message' => $e->getMessage()]);
|
||||
|
||||
return response()->json(['error' => 'Terjadi kesalahan saat memproses data: ' . $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function gapProfil($alternatif, $kriteria)
|
||||
{
|
||||
$resultsGAP = [];
|
||||
$gapValues = [];
|
||||
|
||||
$dosenProfile = ProfileMethod::with('kriteria', 'subkriteria')->whereIn('id_alternatif', $alternatif)->get();
|
||||
|
||||
foreach ($dosenProfile as $dosen) {
|
||||
|
||||
$totalKeahlianUtama = ProfileMethod::with('kriteria')
|
||||
->where('id_alternatif', $dosen->id_alternatif)
|
||||
->whereHas('kriteria', function ($query) {
|
||||
$query->where('kriteria_name', 'Keahlian Utama');
|
||||
})->count();
|
||||
|
||||
foreach ($kriteria as $subkriteriaId) {
|
||||
$idealValue = Subkriteria::with('kriteria')->find($subkriteriaId);
|
||||
$idealKriteria = $idealValue->kriteria;
|
||||
|
||||
if ($dosen->kriteria->id_kriteria == $idealKriteria->id_kriteria) {
|
||||
$dosenNilai = optional($dosen->subkriteria->nilai)->value;
|
||||
$idealNilai = optional($idealValue->nilai)->value;
|
||||
|
||||
$gap = $dosenNilai - $idealNilai;
|
||||
|
||||
if ($idealKriteria->kriteria_name === 'Keahlian Utama') {
|
||||
if ($totalKeahlianUtama > 1) {
|
||||
if (abs($gap) <= 1) {
|
||||
$gapValues[$idealKriteria->id_kriteria] = $gap;
|
||||
}
|
||||
} else {
|
||||
$gapValues[$idealKriteria->id_kriteria] = $gap;
|
||||
}
|
||||
} else {
|
||||
$gapValues[$idealKriteria->id_kriteria] = $gap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($gapValues)) {
|
||||
ksort($gapValues);
|
||||
$resultsGAP[$dosen->id_alternatif] = $gapValues;
|
||||
}
|
||||
}
|
||||
Log::info('Ideal Value:', ['data' => $idealValue]);
|
||||
Log::info('GAP Values:', $resultsGAP);
|
||||
|
||||
return $resultsGAP;
|
||||
}
|
||||
|
||||
private function normalizeGAP($resultsGAP)
|
||||
{
|
||||
$normalizedGAP = [];
|
||||
$normalizedValues = [];
|
||||
$conversionTable = [
|
||||
0 => 5,
|
||||
1 => 4.5,
|
||||
-1 => 4,
|
||||
2 => 3.5,
|
||||
-2 => 3,
|
||||
3 => 2.5,
|
||||
-3 => 2,
|
||||
4 => 1.5,
|
||||
-4 => 1
|
||||
];
|
||||
|
||||
foreach ($resultsGAP as $dosenId => $gapValues) {
|
||||
|
||||
foreach ($gapValues as $key => $gap) {
|
||||
$normalizedValues[$key] = $conversionTable[$gap] ?? 1;
|
||||
}
|
||||
|
||||
$normalizedGAP[$dosenId] = $normalizedValues;
|
||||
}
|
||||
|
||||
Log::info('Pemetaan GAP:', $normalizedGAP);
|
||||
|
||||
return $normalizedGAP;
|
||||
}
|
||||
|
||||
private function factorValue($normalizedGAP) {
|
||||
$resultsFactor = [];
|
||||
|
||||
foreach ($normalizedGAP as $dosenId => $gapValues) {
|
||||
$dataAspek = Aspek::all();
|
||||
$aspek = [];
|
||||
|
||||
foreach ($dataAspek as $aspekValue) {
|
||||
$aspekId = $aspekValue->id_aspek;
|
||||
|
||||
$coreValues = 0;
|
||||
$secondaryValues = 0;
|
||||
$coreCount = 0;
|
||||
$secondaryCount = 0;
|
||||
$factorValue = [];
|
||||
|
||||
foreach ($gapValues as $kriteria => $values) {
|
||||
$factor = Kriteria::find($kriteria);
|
||||
|
||||
if ($factor->tipe == 'Core Factor') {
|
||||
if ($aspekId == $factor->id_aspek) {
|
||||
$coreValues += $values;
|
||||
$coreCount++;
|
||||
}
|
||||
} else {
|
||||
if ($aspekId == $factor->id_aspek) {
|
||||
$secondaryValues += $values;
|
||||
$secondaryCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($coreCount > 0) {
|
||||
$factorValue['NCF'] = $coreValues / $coreCount;
|
||||
}
|
||||
if ($secondaryCount > 0) {
|
||||
$factorValue['NSF'] = $secondaryValues / $secondaryCount;
|
||||
}
|
||||
|
||||
$aspek[$aspekId] = $factorValue;
|
||||
}
|
||||
$resultsFactor[$dosenId] = $aspek;
|
||||
}
|
||||
|
||||
Log::info('NCSF:', $resultsFactor);
|
||||
|
||||
return $resultsFactor;
|
||||
}
|
||||
|
||||
private function totalValue($factorValue)
|
||||
{
|
||||
$totalValues = [];
|
||||
$aspek = [];
|
||||
$totalValueFactor = [];
|
||||
$bobotCF = 60;
|
||||
$bobotSF = 40;
|
||||
|
||||
foreach ($factorValue as $dosenId => $value) {
|
||||
foreach ($value as $aspekId => $values) {
|
||||
$value = [];
|
||||
|
||||
foreach ($values as $tipeValue => $valueFactor) {
|
||||
if ($tipeValue == 'NCF') {
|
||||
$value[] = $valueFactor * $bobotCF / 100;
|
||||
} else {
|
||||
$value[] = $valueFactor * $bobotSF / 100;
|
||||
}
|
||||
}
|
||||
$totalValueFactor = array_sum($value);
|
||||
$aspek[$aspekId] = $totalValueFactor;
|
||||
}
|
||||
$totalValues[$dosenId] = $aspek;
|
||||
}
|
||||
|
||||
Log::info('Nilai Total:', $totalValues);
|
||||
|
||||
return $totalValues;
|
||||
}
|
||||
|
||||
private function rankAlternatif($totalValues)
|
||||
{
|
||||
$rankedResults = [];
|
||||
|
||||
foreach ($totalValues as $dosenId => $totalValue) {
|
||||
$ha = 0;
|
||||
|
||||
foreach ($totalValue as $aspekId => $value) {
|
||||
$bobotAspek = Aspek::where('id_aspek', $aspekId)->pluck('persentase')->first();
|
||||
if ($bobotAspek) {
|
||||
$ha += $value * ($bobotAspek / 100);
|
||||
}
|
||||
}
|
||||
$alternatif = Alternatif::where('id_alternatif', $dosenId)->first();
|
||||
|
||||
$rankedResults[] = [
|
||||
'dosenId' => $alternatif->id_alternatif,
|
||||
'dosenName' => $alternatif->name,
|
||||
'hasilAkhir' => $ha,
|
||||
];
|
||||
}
|
||||
|
||||
usort($rankedResults, function ($a, $b) {
|
||||
return $b['hasilAkhir'] <=> $a['hasilAkhir'];
|
||||
});
|
||||
|
||||
foreach ($rankedResults as $index => &$result) {
|
||||
$result['rank'] = $index + 1;
|
||||
}
|
||||
|
||||
Log::info('Ranking:', $rankedResults);
|
||||
|
||||
return $rankedResults;
|
||||
}
|
||||
|
||||
public function submit(SubmissionRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Submissions::create($validated);
|
||||
|
||||
return redirect()->route('results.data')->with('success', 'Pengajuan Judul Berhasil');
|
||||
// return view('profile-matching.result');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Pengajuan Judul Gagal: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ProfileMethod\ProfileMethodRequest;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\Subkriteria;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProfileMethodController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['profile_method'] = ProfileMethod::all();
|
||||
$data['kriteria'] = Kriteria::with('subkriteria')->get();
|
||||
|
||||
return view('pages.profile-method.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['alternatif'] = Alternatif::with('profile_method')->whereDoesntHave('profile_method')->get();
|
||||
$data['kriteria'] = Kriteria::all();
|
||||
$data['subkriteria'] = Subkriteria::all();
|
||||
|
||||
return view('pages.profile-method.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(ProfileMethodRequest $request)
|
||||
{
|
||||
try {
|
||||
foreach ($request->kriteria as $id_kriteria => $id_subkriteria) {
|
||||
if (is_array($id_subkriteria)) {
|
||||
foreach ($id_subkriteria as $subId) {
|
||||
if ($subId) {
|
||||
ProfileMethod::updateOrCreate(
|
||||
[
|
||||
'id_alternatif' => $request->id_alternatif,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
'id_subkriteria' => $subId,
|
||||
],
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($id_subkriteria) {
|
||||
ProfileMethod::updateOrCreate(
|
||||
[
|
||||
'id_alternatif' => $request->id_alternatif,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
],
|
||||
[
|
||||
'id_subkriteria' => $id_subkriteria,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('method-profile.index')->with('success', 'Data Berhasil Ditambah');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menambahkan Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
$data['profile_method'] = ProfileMethod::with('alternatif', 'kriteria', 'subkriteria')
|
||||
->where('id_alternatif', $id)
|
||||
->get();
|
||||
$data['alternatif'] = Alternatif::findOrFail($id);
|
||||
$data['kriteria'] = Kriteria::all();
|
||||
|
||||
return view('pages.profile-method.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(ProfileMethodRequest $request, string $id)
|
||||
{
|
||||
try {
|
||||
foreach ($request->kriteria as $id_kriteria => $id_subkriteria) {
|
||||
if (is_array($id_subkriteria)) {
|
||||
// Hapus semua yang tidak termasuk dalam pilihan baru
|
||||
ProfileMethod::where('id_alternatif', $request->id_alternatif)
|
||||
->where('id_kriteria', $id_kriteria)
|
||||
->whereNotIn('id_subkriteria', $id_subkriteria)
|
||||
->delete();
|
||||
|
||||
foreach ($id_subkriteria as $subId) {
|
||||
if ($subId) {
|
||||
ProfileMethod::updateOrCreate(
|
||||
[
|
||||
'id_alternatif' => $request->id_alternatif,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
'id_subkriteria' => $subId,
|
||||
],
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($id_subkriteria) {
|
||||
// Update untuk kriteria dengan 1 nilai saja
|
||||
ProfileMethod::updateOrCreate(
|
||||
[
|
||||
'id_alternatif' => $request->id_alternatif,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
],
|
||||
[
|
||||
'id_subkriteria' => $id_subkriteria,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('method-profile.index')->with('success', 'Data Berhasil Diperbarui');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Memperbarui Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
try {
|
||||
$profile_method = ProfileMethod::where('id_alternatif', $id);
|
||||
|
||||
$profile_method->delete();
|
||||
|
||||
return redirect()->route('method-profile.index')->with('success', 'Data Berhasil Dihapus');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menghapus Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Subkriteria\SubkriteriaRequest;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Nilai;
|
||||
use App\Models\Subkriteria;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SubkriteriaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['subkriteria'] = Subkriteria::all();
|
||||
|
||||
return view('pages.subkriteria.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create(Kriteria $kriteria)
|
||||
{
|
||||
$count = Subkriteria::where('id_kriteria', $kriteria->id_kriteria)->count();
|
||||
|
||||
if ($count >= 5) {
|
||||
return redirect()->route('kriteria.edit', $kriteria)->withErrors(['Kriteria ' . $kriteria->kriteria_name .' sudah memiliki subkriteria maksimal 5']);
|
||||
}
|
||||
|
||||
$data['kriteria'] = $kriteria;
|
||||
$data['nilai'] = Nilai::all();
|
||||
|
||||
return view('pages.subkriteria.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(SubkriteriaRequest $request, $kriteria)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Subkriteria::create($validated);
|
||||
|
||||
return redirect()->route('kriteria.edit', $kriteria)->with('success', 'Data Berhasil Ditambah');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menambahkan Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Kriteria $kriteria, Subkriteria $subkriteria)
|
||||
{
|
||||
$data['subkriteria'] = $subkriteria;
|
||||
$data['kriteria'] = $kriteria;
|
||||
$data['nilai'] = Nilai::all();
|
||||
|
||||
return view('pages.subkriteria.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Kriteria $kriteria, Subkriteria $subkriteria)
|
||||
{
|
||||
$data['subkriteria'] = $subkriteria;
|
||||
$data['kriteria'] = $kriteria;
|
||||
$data['nilai'] = Nilai::all();
|
||||
|
||||
return view('pages.subkriteria.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(SubkriteriaRequest $request, $kriteria, $subkriteria)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
Subkriteria::find($subkriteria)->update($validated);
|
||||
|
||||
return redirect()->route('kriteria.edit', $kriteria)->with('success', 'Data Berhasil Diperbarui');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return back()->with(['error' => 'Gagal Mengubah Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($kriteria, $subkriteria)
|
||||
{
|
||||
try {
|
||||
Subkriteria::find($subkriteria)->delete();
|
||||
|
||||
return redirect()->route('kriteria.edit', $kriteria)->with('success', 'Data Berhasil Dihapus');
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return back()->with(['error' => 'Gagal Menghapus Data: ' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\SubmissionCreated;
|
||||
use App\Http\Requests\Submission\SubmissionRequest;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\IzinPemilihan;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\SubmissionDetail;
|
||||
use App\Models\Submissions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SubmissionsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['submission'] = Submissions::with(['submission_detail', 'users'])->get();
|
||||
$data['submission_detail'] = SubmissionDetail::with('alternatif')->get();
|
||||
$data['profile'] = ProfileMethod::with(['alternatif', 'kriteria', 'subkriteria'])->get();
|
||||
$data['kriteria'] = Kriteria::with('subkriteria')->get();
|
||||
$data['izin'] = IzinPemilihan::first();
|
||||
|
||||
return view('pages.submissions.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['alternatif'] = Alternatif::all();
|
||||
$data['izin'] = IzinPemilihan::first();
|
||||
|
||||
if (Auth::check()) {
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user->hasRole(User::ROLE_MAHASISWA)) {
|
||||
if (empty($user->nim) || empty($user->id_angkatan)) {
|
||||
Log::error('Submission gagal: Profil tidak lengkap', [
|
||||
'id' => $user->id,
|
||||
'nim' => $user->nim,
|
||||
'id_angkatan' => $user->id_angkatan,
|
||||
]);
|
||||
|
||||
return redirect()->route('profile.edit')->withErrors(['error' => 'Gagal mengakses pengajuan: Silahkan lengkapi profil anda!']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('pages.submissions.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(SubmissionRequest $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validatedSubmission = $request->validated();
|
||||
|
||||
$submission = Submissions::create([
|
||||
'id' => $validatedSubmission['id'],
|
||||
'judul' => $validatedSubmission['judul'],
|
||||
'deskripsi' => $validatedSubmission['deskripsi'],
|
||||
'prodi' => $validatedSubmission['prodi'],
|
||||
]);
|
||||
|
||||
SubmissionDetail::create([
|
||||
'id_submission' => $submission->id_submission,
|
||||
'id_alternatif' => $validatedSubmission['id_alternatif'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect()->route('submissions.create')->with('success', 'Pengajuan Berhasil');
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return back()->withErrors(['error' => 'Pengajuan Gagal: Terjadi kesalahan!']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\IzinPemilihan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SystemController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function updatePermission(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'izin' => 'required|in:on,off'
|
||||
]);
|
||||
|
||||
$izin = IzinPemilihan::first();
|
||||
$izin->izin = $request->izin;
|
||||
$izin->save();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Izin berhasil diperbarui!',
|
||||
'izin' => $izin->izin
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Alternatif;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AlternatifRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nip' => ['required', 'string', 'max:225'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom error messages for validation errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'nip.required' => 'NIP harus diisi.',
|
||||
'nip.string' => 'NIP harus berupa teks.',
|
||||
'nip.max' => 'NIP tidak boleh lebih dari 255 karakter.',
|
||||
'name.required' => 'Nama Kriteria harus diisi.',
|
||||
'name.string' => 'Nama Kriteria harus berupa teks.',
|
||||
'name.max' => 'Nama Kriteria tidak boleh lebih dari 255 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Aspek;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AspekCreateRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'aspek_name' => ['required', 'string', 'max:225'],
|
||||
'persentase' => ['required', 'string', 'min:0', 'max:100'],
|
||||
'keterangan' => ['nullable', 'string', 'max:500'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'aspek_name.required' => 'Nama aspek wajib diisi.',
|
||||
'aspek_name.string' => 'Nama aspek harus berupa teks.',
|
||||
'aspek_name.max' => 'Nama aspek maksimal 225 karakter.',
|
||||
|
||||
'persentase.required' => 'Persentase wajib diisi.',
|
||||
'persentase.numeric' => 'Persentase harus berupa angka.',
|
||||
'persentase.min' => 'Persentase tidak boleh kurang dari 0.',
|
||||
'persentase.max' => 'Persentase tidak boleh lebih dari 100.',
|
||||
|
||||
'keterangan.string' => 'Keterangan harus berupa teks.',
|
||||
'keterangan.max' => 'Keterangan maksimal 500 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -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\ValidationRule|array<mixed>|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(): void
|
||||
{
|
||||
$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,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Kriteria;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class KriteriaRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'kriteria_name' => ['required', 'string', 'max:255'],
|
||||
'tipe' => ['required', 'string', 'in:Core Factor,Secondary Factor'],
|
||||
'id_aspek' => ['required'],
|
||||
'keterangan' => ['nullable', 'string', 'max:500'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom error messages for validation errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'kriteria_name.required' => 'Nama Kriteria harus diisi.',
|
||||
'kriteria_name.string' => 'Nama Kriteria harus berupa teks.',
|
||||
'kriteria_name.max' => 'Nama Kriteria tidak boleh lebih dari 255 karakter.',
|
||||
'id_aspek.required' => 'Aspek harus dipilih.',
|
||||
'tipe.required' => 'Tipe harus diisi.',
|
||||
'tipe.string' => 'Tipe harus berupa teks.',
|
||||
'tipe.in' => 'Tipe harus salah satu dari Core Factor atau Secondary Factor.',
|
||||
'keterangan.string' => 'Keterangan harus berupa teks.',
|
||||
'keterangan.max' => 'Keterangan tidak boleh lebih dari 500 karakter.',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\ProfileMatching;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ProfileMatchingRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// $rules = [
|
||||
// 'judul' => ['required', 'max:255'],
|
||||
// 'deskripsi' => ['required', 'max:255'],
|
||||
// ];
|
||||
|
||||
$rules['kriteria'] = ['required', 'array'];
|
||||
foreach (range(0, 3) as $index) {
|
||||
$rules["kriteria.$index"] = ['required', 'exists:subkriteria,id_subkriteria'];
|
||||
}
|
||||
|
||||
$rules['alternatif'] = ['required', 'array', 'min:1', 'max:3'];
|
||||
foreach (range(0, 2) as $index) {
|
||||
$rules["alternatif.$index"] = ['nullable', 'exists:alternatif,id_alternatif'];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom error messages for validation errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
$messages = [
|
||||
'judul.required' => 'Judul harus diisi.',
|
||||
'judul.max' => 'Judul tidak boleh lebih dari 255 karakter.',
|
||||
'deskripsi.required' => 'Deskripsi harus diisi.',
|
||||
|
||||
'kriteria.required' => 'Semua kriteria harus diisi.',
|
||||
'kriteria.array' => 'Format kriteria tidak valid.',
|
||||
'kriteria.*.exists' => 'Kriteria yang dipilih tidak valid.',
|
||||
|
||||
'alternatif.required' => 'Setidaknya satu alternatif harus dipilih.',
|
||||
'alternatif.array' => 'Format alternatif tidak valid.',
|
||||
'alternatif.min' => 'Setidaknya satu alternatif harus dipilih.',
|
||||
'alternatif.max' => 'Tidak boleh lebih dari tiga alternatif.',
|
||||
'alternatif.*.exists' => 'Alternatif yang dipilih tidak valid.',
|
||||
];
|
||||
|
||||
return $messages;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\ProfileMethod;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ProfileMethodRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id_alternatif' => 'required|exists:alternatif,id_alternatif',
|
||||
'kriteria' => 'required|array',
|
||||
'kriteria.*' => 'required|exists:subkriteria,id_subkriteria',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Pesan error khusus untuk validasi.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'id_alternatif.required' => 'Nama alternatif wajib diisi.',
|
||||
'id_alternatif.exists' => 'Alternatif yang dipilih tidak valid.',
|
||||
'kriteria.required' => 'Nilai kriteria harus diisi.',
|
||||
'kriteria.*.exists' => 'Subkriteria yang dipilih tidak valid.',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nim' => ['required', 'string'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => [
|
||||
'required',
|
||||
'string',
|
||||
'lowercase',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique(User::class)->ignore($this->user()->id),
|
||||
],
|
||||
'id_angkatan' => [
|
||||
'required'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Subkriteria;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SubkriteriaRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id_kriteria' => ['required'],
|
||||
'subkriteria_name' => ['required', 'string', 'max:255'],
|
||||
// 'id_nilai' => ['required'],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Submission;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SubmissionDetailRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id_submission' => ['required'],
|
||||
'id_alternatif' => ['required'],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Submission;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SubmissionRequest 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\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => ['required'],
|
||||
'prodi' => ['required', 'string', 'max:255'],
|
||||
'judul' => ['required', 'string', 'max:255'],
|
||||
'deskripsi' => ['required', 'string', 'max:255'],
|
||||
'id_alternatif' => ['required'],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class AspekResource extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'aspek' => $this->collection,
|
||||
'pagination' => [
|
||||
'total' => $this->total(),
|
||||
'count' => $this->count(),
|
||||
'per_page' => $this->perPage(),
|
||||
'current_page' => $this->currentPage(),
|
||||
'total_pages' => $this->lastPage()
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class KriteriaResource extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'data' => $this->collection,
|
||||
'pagination' => [
|
||||
'total' => $this->total(),
|
||||
'count' => $this->count(),
|
||||
'per_page' => $this->perPage(),
|
||||
'current_page' => $this->currentPage(),
|
||||
'total_pages' => $this->lastPage()
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class ProfileMethodResource extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'profile' => $this->collection,
|
||||
'pagination' => [
|
||||
'total' => $this->total(),
|
||||
'count' => $this->count(),
|
||||
'per_page' => $this->perPage(),
|
||||
'current_page' => $this->currentPage(),
|
||||
'total_pages' => $this->lastPage()
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\SubmissionDetail;
|
||||
use App\Models\Submissions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProcessSubmission implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
|
||||
protected $submissions;
|
||||
|
||||
public function __construct(Submissions $submission)
|
||||
{
|
||||
$this->submissions = $submission;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
Log::info("Menjalankan ProcessSubmission untuk submission: ", ['id_submission' => $this->submissions->id_submission]);
|
||||
|
||||
$user = User::find($this->submissions->id);
|
||||
|
||||
if (!$user || !$user->id_angkatan) {
|
||||
Log::warning('Submission dibuat user tanpa data angkatan.', ['id_submission' => $this->submissions->id_submission]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Tunggu hingga SubmissionDetail tersedia
|
||||
$maxRetries = 5;
|
||||
$retryInterval = 2; // Coba setiap 2 detik
|
||||
|
||||
for ($i = 0; $i < $maxRetries; $i++) {
|
||||
$submissionDetails = SubmissionDetail::where('id_submission', $this->submissions->id_submission)->get();
|
||||
|
||||
if (!$submissionDetails->isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Log::info("Menunggu SubmissionDetail dalam job untuk id_submission: " . $this->submissions->id_submission);
|
||||
sleep($retryInterval);
|
||||
}
|
||||
|
||||
if ($submissionDetails->isEmpty()) {
|
||||
Log::warning('SubmissionDetail masih tidak ditemukan setelah menunggu di job.', ['id_submission' => $this->submissions->id_submission]);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_angkatan = $user->id_angkatan;
|
||||
|
||||
$alternatifCounts = SubmissionDetail::join('submission', 'submission.id_submission', '=', 'submission_detail.id_submission')
|
||||
->join('users', 'users.id', '=', 'submission.id_user')
|
||||
->where('users.angkatan', $id_angkatan)
|
||||
->selectRaw('id_alternatif, COUNT(*) as total_permintaan')
|
||||
->groupBy('id_alternatif')
|
||||
->pluck('total_permintaan', 'id_alternatif');
|
||||
|
||||
foreach ($submissionDetails as $detail) {
|
||||
$id_alternatif = $detail->id_alternatif;
|
||||
$total_permintaan = $alternatifCounts[$id_alternatif] ?? 0;
|
||||
|
||||
$kuotaMax = ProfileMethod::where('id_alternatif', $id_alternatif)->value('id_nilai') ?? 0;
|
||||
|
||||
$rasio = ($total_permintaan > 0 && $kuotaMax > 0) ? ($total_permintaan / $kuotaMax) * 100 : 0;
|
||||
|
||||
Log::info('Perhitungan kuota untuk alternatif', [
|
||||
'id_alternatif' => $id_alternatif,
|
||||
'total_permintaan' => $total_permintaan,
|
||||
'kuota_maksimum' => $kuotaMax,
|
||||
'rasio_kuota' => $rasio . '%'
|
||||
]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Terjadi kesalahan saat menghitung kuota dalam job:', [
|
||||
'id_submission' => $this->submissions->id_submission,
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Alternatif extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'alternatif';
|
||||
|
||||
protected $primaryKey = 'id_alternatif';
|
||||
|
||||
protected $fillable = [
|
||||
'nip',
|
||||
'name',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::saving(function ($model) {
|
||||
if (!empty($model->nip)) {
|
||||
$model->nip = self::formatNip($model->nip);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function formatNip($nip)
|
||||
{
|
||||
$nip = preg_replace('/\s+/', '', $nip);
|
||||
|
||||
return substr($nip, 0, 8) . ' ' .
|
||||
substr($nip, 8, 6) . ' ' .
|
||||
substr($nip, 14, 1) . ' ' .
|
||||
substr($nip, 15);
|
||||
}
|
||||
|
||||
public function profile_method()
|
||||
{
|
||||
return $this->hasMany(ProfileMethod::class, 'id_alternatif');
|
||||
}
|
||||
|
||||
public function submission_detail()
|
||||
{
|
||||
return $this->hasMany(SubmissionDetail::class, 'id_alternatif');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Angkatan extends Model
|
||||
{
|
||||
protected $table = 'angkatan';
|
||||
|
||||
protected $primaryKey = 'id_angkatan';
|
||||
|
||||
protected $fillable = [
|
||||
'tahun',
|
||||
// 'jumlah_mahasiswa',
|
||||
];
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class, 'id_angkatan');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Aspek extends Model
|
||||
{
|
||||
protected $table = 'aspek';
|
||||
|
||||
protected $primaryKey = 'id_aspek';
|
||||
|
||||
protected $fillable = [
|
||||
'kode_aspek',
|
||||
'aspek_name',
|
||||
'persentase',
|
||||
'keterangan'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($aspek) {
|
||||
$latestAspek = self::latest('id_aspek')->first();
|
||||
$lastNumber = $latestAspek ? intval(substr($latestAspek->kode_aspek, 1)) : 0;
|
||||
$newNumber = $lastNumber + 1;
|
||||
|
||||
$aspek->kode_aspek = 'A' . str_pad($newNumber, 3, '0', STR_PAD_LEFT);
|
||||
});
|
||||
}
|
||||
|
||||
public function kriteria()
|
||||
{
|
||||
return $this->hasMany(Kriteria::class, 'id_aspek');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class IzinPemilihan extends Model
|
||||
{
|
||||
protected $table = 'izin_pengajuan';
|
||||
|
||||
protected $primaryKey = 'id_pengaturan';
|
||||
|
||||
protected $fillable = [
|
||||
'izin',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Kriteria extends Model
|
||||
{
|
||||
const TIPE_CORE = 'Core Factor';
|
||||
const TIPE_SECONDARY = 'Secondary Factor';
|
||||
|
||||
protected $table = 'kriteria';
|
||||
|
||||
protected $primaryKey = 'id_kriteria';
|
||||
|
||||
protected $fillable = [
|
||||
'kode_kriteria',
|
||||
'id_aspek',
|
||||
'kriteria_name',
|
||||
'tipe',
|
||||
'keterangan'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($kriteria) {
|
||||
$latestKriteria = self::latest('id_kriteria')->first();
|
||||
$lastNumber = $latestKriteria ? intval(substr($latestKriteria->kode_kriteria, 1)) : 0;
|
||||
$newNumber = $lastNumber + 1;
|
||||
|
||||
$kriteria->kode_kriteria = 'K' . str_pad($newNumber, 3, '0', STR_PAD_LEFT);
|
||||
});
|
||||
}
|
||||
|
||||
public static function getTipeOptions()
|
||||
{
|
||||
return [
|
||||
self::TIPE_CORE => 'Core Factor',
|
||||
self::TIPE_SECONDARY => 'Secondary Factor',
|
||||
];
|
||||
}
|
||||
|
||||
public function aspek()
|
||||
{
|
||||
return $this->belongsTo(Aspek::class, 'id_aspek');
|
||||
}
|
||||
|
||||
public function subkriteria()
|
||||
{
|
||||
return $this->hasMany(Subkriteria::class, 'id_kriteria');
|
||||
}
|
||||
|
||||
public function profile_method()
|
||||
{
|
||||
return $this->hasMany(ProfileMethod::class, 'id_kriteria');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Nilai extends Model
|
||||
{
|
||||
protected $table = 'nilai';
|
||||
|
||||
protected $primaryKey = 'id_nilai';
|
||||
|
||||
protected $fillable = [
|
||||
'value',
|
||||
];
|
||||
|
||||
public function subkriteria()
|
||||
{
|
||||
return $this->hasMany(Subkriteria::class, 'id_nilai');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProfileMethod extends Model
|
||||
{
|
||||
protected $table = 'profile_method';
|
||||
|
||||
protected $primaryKey = 'id_profile';
|
||||
|
||||
protected $fillable = [
|
||||
'id_alternatif',
|
||||
'id_kriteria',
|
||||
'id_subkriteria',
|
||||
];
|
||||
|
||||
public function alternatif()
|
||||
{
|
||||
return $this->belongsTo(Alternatif::class, 'id_alternatif');
|
||||
}
|
||||
|
||||
public function kriteria()
|
||||
{
|
||||
return $this->belongsTo(Kriteria::class, 'id_kriteria');
|
||||
}
|
||||
|
||||
public function subkriteria()
|
||||
{
|
||||
return $this->belongsTo(Subkriteria::class, 'id_subkriteria');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
public const ABOUT_US = 'about_us';
|
||||
public const PRIVACY_POLICY = 'privacy_policy';
|
||||
public const LEGALITY = 'legality';
|
||||
public const DOCUMENT_PROCESSING = 'document_processing';
|
||||
public const ID = 'id';
|
||||
public const EN = 'en';
|
||||
public const NAME = 'name';
|
||||
public const EMAIL = 'email';
|
||||
public const PHONE = 'phone';
|
||||
public const ADDRESS = 'address';
|
||||
public const META_DESCRIPTION = 'meta_description';
|
||||
public const EMAIL_SETTING = 'email_setting';
|
||||
public const EMAIL_INVITATION = 'email_invitation';
|
||||
public const EXCELLENCE = 'excellence';
|
||||
public const TITLE = 'title';
|
||||
public const KEYWORD = 'keyword';
|
||||
public const DESCRIPTION = 'description';
|
||||
public const LOGO = 'logo';
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'locale',
|
||||
'value',
|
||||
'additional_value',
|
||||
'json_value',
|
||||
'additional_json_value',
|
||||
];
|
||||
|
||||
public function scopeKey($query, $key)
|
||||
{
|
||||
return $query->where('key', $key);
|
||||
}
|
||||
|
||||
public function scopeLocale($query, $lang)
|
||||
{
|
||||
return $query->whereLocale($lang);
|
||||
}
|
||||
|
||||
public function getJsonValueAttribute($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
}
|
||||
|
||||
public function getAdditionalJsonValueAttribute($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Events\KuotaUpdated;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Subkriteria extends Model
|
||||
{
|
||||
protected $table = 'subkriteria';
|
||||
|
||||
protected $primaryKey = 'id_subkriteria';
|
||||
|
||||
protected $fillable = [
|
||||
'id_kriteria',
|
||||
'subkriteria_name',
|
||||
'id_nilai'
|
||||
];
|
||||
|
||||
public function kriteria()
|
||||
{
|
||||
return $this->belongsTo(Kriteria::class, 'id_kriteria');
|
||||
}
|
||||
|
||||
public function nilai()
|
||||
{
|
||||
return $this->belongsTo(nilai::class, 'id_nilai');
|
||||
}
|
||||
|
||||
public function profile_method()
|
||||
{
|
||||
return $this->hasMany(ProfileMethod::class, 'id_subkriteria');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Observers\SubmissionsDetailObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
#[ObservedBy([SubmissionsDetailObserver::class])]
|
||||
class SubmissionDetail extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'submission_detail';
|
||||
|
||||
protected $primaryKey = 'id_submission_detail';
|
||||
|
||||
protected $fillable = [
|
||||
'id_submission',
|
||||
'id_alternatif',
|
||||
];
|
||||
|
||||
public function submission()
|
||||
{
|
||||
return $this->belongsTo(Submissions::class, 'id_submission');
|
||||
}
|
||||
|
||||
public function alternatif()
|
||||
{
|
||||
return $this->belongsTo(Alternatif::class, 'id_alternatif');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Events\SubmissionCreated;
|
||||
use App\Observers\SubmissionsObserver;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Submissions extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'submission';
|
||||
|
||||
protected $primaryKey = 'id_submission';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'judul',
|
||||
'deskripsi',
|
||||
'prodi',
|
||||
];
|
||||
|
||||
// protected static function booted()
|
||||
// {
|
||||
// static::observe(SubmissionsObserver::class);
|
||||
// }
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id');
|
||||
}
|
||||
|
||||
public function submission_detail()
|
||||
{
|
||||
return $this->hasMany(SubmissionDetail::class, 'id_submission');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable implements MustVerifyEmail
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable, HasRoles;
|
||||
|
||||
public const ROLE_ADMIN = 'admin';
|
||||
public const ROLE_MAHASISWA = 'mahasiswa';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'nim',
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'id_angkatan',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 angkatan()
|
||||
{
|
||||
return $this->belongsTo(Angkatan::class, 'id_angkatan');
|
||||
}
|
||||
|
||||
public function submission()
|
||||
{
|
||||
return $this->hasMany(Submissions::class, 'id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\Subkriteria;
|
||||
use App\Models\SubmissionDetail;
|
||||
use App\Models\Submissions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SubmissionsDetailObserver
|
||||
{
|
||||
/**
|
||||
* Handle the SubmissionDetail "created" event.
|
||||
*/
|
||||
public function created(SubmissionDetail $submissionDetail): void
|
||||
{
|
||||
try {
|
||||
Log::info("Observer berjalan", ['id_submission' => $submissionDetail->id_submission]);
|
||||
|
||||
$submission = Submissions::find($submissionDetail->id_submission);
|
||||
if (!$submission) {
|
||||
Log::warning('Submission tidak ditemukan.', ['id_submission' => $submissionDetail->id_submission]);
|
||||
return;
|
||||
}
|
||||
|
||||
$user = User::find($submission->id);
|
||||
if (!$user || !$user->id_angkatan) {
|
||||
Log::warning('User tidak ditemukan atau tidak memiliki id_angkatan.', ['id_submission' => $submissionDetail->id_submission]);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_angkatan = $user->id_angkatan;
|
||||
|
||||
$alternatifCounts = SubmissionDetail::join('submission', 'submission.id_submission', '=', 'submission_detail.id_submission')
|
||||
->join('users', 'users.id', '=', 'submission.id')
|
||||
->where('users.id_angkatan', $id_angkatan)
|
||||
->selectRaw('id_alternatif, COUNT(*) as total_permintaan')
|
||||
->groupBy('id_alternatif')
|
||||
->pluck('total_permintaan', 'id_alternatif');
|
||||
|
||||
$id_alternatif = $submissionDetail->id_alternatif;
|
||||
if (!$id_alternatif) {
|
||||
Log::error('SubmissionDetail tidak memiliki id_alternatif', ['id_submission' => $submissionDetail->id_submission]);
|
||||
return;
|
||||
}
|
||||
|
||||
$total_permintaan = $alternatifCounts[$id_alternatif] ?? 0;
|
||||
|
||||
$subkriteriadata = ProfileMethod::join('subkriteria', 'subkriteria.id_subkriteria', '=', 'profile_method.id_subkriteria')
|
||||
->where('profile_method.id_alternatif', $id_alternatif)
|
||||
->value('subkriteria.subkriteria_name') ?? 0;
|
||||
|
||||
$pemenuhanKuota = ProfileMethod::join('subkriteria', 'subkriteria.id_subkriteria', '=', 'profile_method.id_subkriteria')
|
||||
->where('profile_method.id_alternatif', $id_alternatif)
|
||||
->where('subkriteria.id_kriteria', 2)
|
||||
->value('subkriteria.subkriteria_name');
|
||||
|
||||
preg_match_all('/\d+/', $subkriteriadata, $matches);
|
||||
$rangeStart = isset($matches[0][0]) ? (int) $matches[0][0] : 0;
|
||||
$rangeEnd = isset($matches[0][1]) ? (int) $matches[0][1] : $rangeStart;
|
||||
|
||||
// komen revisi
|
||||
// $rasio = ($total_permintaan > 0 && $kuotaMax > 0) ? ($total_permintaan / $kuotaMax) * 100 : 0;
|
||||
|
||||
$rasio = ($total_permintaan >= $rangeEnd) ? 'Terpenuhi' : 'Belum Terpenuhi';
|
||||
|
||||
if ($rasio !== $pemenuhanKuota) {
|
||||
ProfileMethod::where('id_alternatif', $id_alternatif)
|
||||
->where('id_kriteria', 2)
|
||||
->update(['id_subkriteria' => 6]);
|
||||
}
|
||||
|
||||
Log::info('Perhitungan Kuota:', [
|
||||
'id_users' => $user->id,
|
||||
'angkatan' => $user->id_angkatan,
|
||||
'id_alternatif' => $id_alternatif,
|
||||
'total_permintaan' => $total_permintaan,
|
||||
'subkriteria' => $subkriteriadata,
|
||||
'rangeStart' => $rangeStart,
|
||||
'rangeEnd' => $rangeEnd,
|
||||
'status' => $rasio,
|
||||
'pemenuhanKuota' => $pemenuhanKuota,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Terjadi kesalahan saat menghitung kuota:', [
|
||||
'id_submission' => $submissionDetail->id_submission,
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the SubmissionDetail "updated" event.
|
||||
*/
|
||||
public function updated(SubmissionDetail $submissionDetail): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the SubmissionDetail "deleted" event.
|
||||
*/
|
||||
public function deleted(SubmissionDetail $submissionDetail): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the SubmissionDetail "restored" event.
|
||||
*/
|
||||
public function restored(SubmissionDetail $submissionDetail): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the SubmissionDetail "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(SubmissionDetail $submissionDetail): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Events\SubmissionCreated;
|
||||
use App\Jobs\ProcessSubmission;
|
||||
use App\Models\Angkatan;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\ProfileMethod;
|
||||
use App\Models\SubmissionDetail;
|
||||
use App\Models\Submissions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SubmissionsObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Submissions "committed" event.
|
||||
*/
|
||||
public function saved(Submissions $submissions): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle the Submissions "updated" event.
|
||||
*/
|
||||
public function updated(Submissions $submissions): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Submissions "deleted" event.
|
||||
*/
|
||||
public function deleted(Submissions $submissions): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Submissions "restored" event.
|
||||
*/
|
||||
public function restored(Submissions $submissions): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Submissions "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Submissions $submissions): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Submissions;
|
||||
use App\Observers\SubmissionsObserver;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Submissions::observe(SubmissionsObserver::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\SubmissionCreated;
|
||||
use App\Listeners\UpdateProfileMethodOnSubmission;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider
|
||||
{
|
||||
// protected $listen = [
|
||||
// SubmissionCreated::class => [
|
||||
// UpdateProfileMethodOnSubmission::class,
|
||||
// ],
|
||||
// ];
|
||||
|
||||
/**
|
||||
* Bootstrap 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');
|
||||
}
|
||||
}
|
|
@ -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,25 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
api: __DIR__.'/../routes/api.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
channels: __DIR__.'/../routes/channels.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->alias([
|
||||
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
||||
'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class,
|
||||
]);
|
||||
$middleware->redirectGuestsTo('/login');
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
})->create();
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
Spatie\Permission\PermissionServiceProvider::class,
|
||||
];
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"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.31",
|
||||
"laravel/reverb": "^1.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/socialite": "^5.18",
|
||||
"laravel/tinker": "^2.9",
|
||||
"spatie/laravel-permission": "^6.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.14",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/breeze": "^2.2",
|
||||
"laravel/pail": "^1.1",
|
||||
"laravel/pint": "^1.13",
|
||||
"laravel/sail": "^1.26",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"phpunit/phpunit": "^11.0.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"files": [
|
||||
"app/Helpers/helpers.php"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
|
@ -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,108 @@
|
|||
<?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: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'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,173 @@
|
|||
<?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),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
],
|
||||
|
||||
'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,77 @@
|
|||
<?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/private'),
|
||||
'serve' => true,
|
||||
'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,116 @@
|
|||
<?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", "resend", "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', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'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',
|
||||
],
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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,186 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
|
||||
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
|
||||
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
|
||||
*/
|
||||
'register_octane_reset_listener' => false,
|
||||
|
||||
/*
|
||||
* Teams Feature.
|
||||
* When set to true the package implements teams using the 'team_foreign_key'.
|
||||
* If you want the migrations to register the 'team_foreign_key', you must
|
||||
* set this to true before doing the migration.
|
||||
* If you already did the migration then you must make a new migration to also
|
||||
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
|
||||
* (view the latest version of this package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* Passport Client Credentials Grant
|
||||
* When set to true the package will use Passports Client to check permissions
|
||||
*/
|
||||
|
||||
'use_passport_client_credentials' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
* See documentation to understand supported syntax.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
/*
|
||||
* The class to use for interpreting wildcard permissions.
|
||||
* If you need to modify delimiters, override the class and specify its name here.
|
||||
*/
|
||||
// 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
|
||||
|
||||
/* Cache-specific settings */
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
|
@ -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'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) 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' => (int) 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' => (int) 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,92 @@
|
|||
<?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'),
|
||||
'server' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
],
|
||||
'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
|
||||
'telescope_ingest_interval' => env('REVERB_TELESCOPE_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),
|
||||
'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30),
|
||||
'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. This will override any values set in the token's
|
||||
| "expires_at" attribute, but first-party sessions are not affected.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Token Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Sanctum can prefix new tokens in order to take advantage of numerous
|
||||
| security scanning initiatives maintained by open source platforms
|
||||
| that notify developers if they commit tokens into repositories.
|
||||
|
|
||||
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
||||
|
|
||||
*/
|
||||
|
||||
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,44 @@
|
|||
<?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.
|
||||
|
|
||||
*/
|
||||
|
||||
'google' => [
|
||||
'client_id' => env('GOOGLE_CLIENT_ID'),
|
||||
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
|
||||
'redirect' => env('GOOGLE_REDIRECT_URI'),
|
||||
],
|
||||
|
||||
'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'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_KEY'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,217 @@
|
|||
<?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,50 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add additional Artisan commands that should
|
||||
| be available within the Tinker environment. Once the command is in
|
||||
| this array you may execute the command in Tinker using its name.
|
||||
|
|
||||
*/
|
||||
|
||||
'commands' => [
|
||||
// App\Console\Commands\ExampleCommand::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto Aliased Classes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Tinker will not automatically alias classes in your vendor namespaces
|
||||
| but you may explicitly allow a subset of classes to get aliased by
|
||||
| adding the names of each of those classes to the following list.
|
||||
|
|
||||
*/
|
||||
|
||||
'alias' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Classes That Should Not Be Aliased
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Typically, Tinker automatically aliases classes as you require them in
|
||||
| Tinker. However, you may wish to never alias certain classes, which
|
||||
| you may accomplish by listing the classes in the following array.
|
||||
|
|
||||
*/
|
||||
|
||||
'dont_alias' => [
|
||||
'App\Nova',
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Alternatif>
|
||||
*/
|
||||
class AlternatifFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'nip' => $this->generateNIP(),
|
||||
'name' => $this->faker->name(),
|
||||
];
|
||||
}
|
||||
|
||||
private function generateNIP(): string
|
||||
{
|
||||
$tahun_lahir = $this->faker->numberBetween(1950, 2000);
|
||||
$bulan_lahir = str_pad($this->faker->numberBetween(1, 12), 2, '0', STR_PAD_LEFT);
|
||||
$tanggal_lahir = str_pad($this->faker->numberBetween(1, 28), 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$tahun_pns = $this->faker->numberBetween(1990, 2023);
|
||||
$bulan_pns = str_pad($this->faker->numberBetween(1, 12), 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$golongan = $this->faker->numberBetween(1, 4);
|
||||
$urutan = str_pad($this->faker->numberBetween(1, 999), 3, '0', STR_PAD_LEFT);
|
||||
|
||||
return "{$tahun_lahir}{$bulan_lahir}{$tanggal_lahir} {$tahun_pns}{$bulan_pns} {$golongan} {$urutan}";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Submissions;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SubmissionDetail>
|
||||
*/
|
||||
class SubmissionDetailFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'id_submission' => Submissions::factory(),
|
||||
'id_alternatif' => Alternatif::factory(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Submissions>
|
||||
*/
|
||||
class SubmissionsFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'id' => User::factory(),
|
||||
'judul' => $this->faker->sentence(),
|
||||
'deskripsi' => $this->faker->text(),
|
||||
'prodi' => 'Teknik Informatika',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'nim' => 'E421' . str_pad(random_int(0, 99999), 5, '0', STR_PAD_LEFT),
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,51 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
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('nim')->uniqid()->nullable();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$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,140 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
//$table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
//$table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
<?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('settings', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('key')->nullable();
|
||||
$table->string('locale', 10)->nullable();
|
||||
$table->text('value')->nullable();
|
||||
$table->text('additional_value')->nullable();
|
||||
$table->json('json_value')->nullable();
|
||||
$table->json('additional_json_value')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue