Upload AMetative

This commit is contained in:
Sangga123 2025-07-14 12:53:24 +07:00
commit 1b77010b19
2073 changed files with 1830944 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

84
.env.example Normal file
View File

@ -0,0 +1,84 @@
APP_NAME="AMetative HLE"
APP_ENV=local
APP_KEY=base64:DyA6OWUyecYnIALx8pF96AYSymkDj/Rk8ULAjd9NOg0=
APP_DEBUG=true
APP_URL=https://hypermedialearning.com/
DB_CONNECTION=mysql
DB_HOST=203.175.9.43
DB_PORT=3306
DB_DATABASE=hypx2768_ametative
DB_USERNAME=hypx2768_admin
DB_PASSWORD=ametativehle2025
MEMCACHED_HOST=203.175.9.43
MAIL_MAILER=smtp
MAIL_HOST=mail.hypermedialearning.com
MAIL_PORT=465
MAIL_USERNAME=admin@hypermedialearning.com
MAIL_PASSWORD=Ng@njuk2023
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=admin@hypermedialearning.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
# PUSHER_APP_ID=
# PUSHER_APP_KEY=
# PUSHER_APP_SECRET=
# PUSHER_APP_CLUSTER=mt1
# MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
# MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
JDOODLE_CLIENT_ID=6b65317573788c6bf68ec4b727e91ff5
JDOODLE_CLIENT_SECRET=62c28769918cf7d41e04e19f2199fddd3ab97bd944a1440120edfd0395a78a84
MEMCACHED_HOST=203.175.9.43
REDIS_HOST=203.175.9.43
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mail.hypermedialearning.com
MAIL_PORT=465
MAIL_USERNAME=admin@hypermedialearning.com
MAIL_PASSWORD=Ng@njuk2023
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=admin@hypermedialearning.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
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
GOOGLE_CLIENT_ID=1018674068547-pe6ifqs3bn3hhmim221e8dqq6rea9r1m.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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
GOOGLE_REDIRECT_URI=https://www.hypermedialearning.com/auth/google/callback

10
.gitattributes vendored Normal file
View File

@ -0,0 +1,10 @@
* text=auto
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode

14
.styleci.yml Normal file
View File

@ -0,0 +1,14 @@
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true

65
README.md Normal file
View File

@ -0,0 +1,65 @@
<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"></a></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.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.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 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 [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
## 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).
# KlasifikasiStudentModelling

32
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AdminDashboardController extends Controller
{
//
public function index()
{
$angkatanCounts = User::whereNotNull('angkatan')
->select('angkatan', DB::raw('count(*) as total'))
->groupBy('angkatan')
->orderBy('angkatan', 'desc')
->get();
$kmCounts = Hasil::select('km_class', DB::raw('count(*) as total'))
->groupBy('km_class')
->orderByRaw("FIELD(km_class, 'High', 'Medium', 'Low')")
->get();
$rmCounts = Hasil::select('rm_class', DB::raw('count(*) as total'))
->groupBy('rm_class')
->orderByRaw("FIELD(rm_class, 'High', 'Medium', 'Low')")
->get();
return view('admin_backend.admin_dashboard', compact('angkatanCounts', 'kmCounts', 'rmCounts'));
}
public function hasRole($id)
{
// foreach ($this->users as $user) {
// if ($user->kelas_user == $id) return true;
// }
return false;
}
}

View File

@ -0,0 +1,140 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use App\Models\Materi;
class AdminMateriController extends Controller
{
public function index()
{
$materi = DB::table('materi')->get();
return view('admin_backend.admin_materi', compact('materi'));
}
public function store(Request $request)
{
$request->validate([
'id_style' => 'required|integer',
'konten' => 'nullable|file|mimes:jpeg,jpg,png,mp4,mov|max:10240',
'audio' => 'nullable|file|mimes:mp3,wav|max:10240',
'teks' => 'nullable|string',
'kodesoal' => 'nullable|string',
'outputkode' => 'nullable|string',
]);
// Data dasar
$data = $request->only(['id_style', 'teks', 'kodesoal', 'outputkode']);
// Upload konten (gambar/video) ke storage/app/public/materi
if ($request->hasFile('konten')) {
$data['konten'] = $request->file('konten')->store('materi', 'public');
}
// Upload audio ke storage/app/public/audio
if ($request->hasFile('audio')) {
$data['audio'] = $request->file('audio')->store('audio', 'public');
}
// Auto-increment manual id_materi per id_style
$maxId = \App\Models\Materi::where('id_style', $data['id_style'])->max('id_materi');
$data['id_materi'] = $maxId ? $maxId + 1 : 1;
\App\Models\Materi::create($data);
return redirect()->route('adminmateri.index')->with('success', 'Materi berhasil ditambah');
}
public function edit($id_style, $id_materi)
{
$item = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
return response()->json($item);
}
public function update(Request $request, $id_style, $id_materi)
{
$request->validate([
'konten' => 'nullable|file|mimes:jpg,jpeg,png,mp4,mov|max:10240',
'audio' => 'nullable|file|mimes:mp3,wav,mpeg|max:10240',
'teks' => 'nullable|string',
'kodesoal' => 'nullable|string',
'outputkode' => 'nullable|string',
]);
if (!$request->hasFile('konten') && !$request->hasFile('audio') && empty($request->teks) && empty($request->kodesoal) && empty($request->outputkode)) {
return back()->withErrors(['konten' => 'Minimal salah satu konten, audio, teks, kodesoal, atau outputkode harus diisi.'])->withInput();
}
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
return back()->with('error', 'Data tidak ditemukan.');
}
$data = [
'teks' => $request->teks,
'kodesoal' => $request->kodesoal,
'outputkode' => $request->outputkode,
];
if ($request->hasFile('konten')) {
if ($materi->konten && Storage::disk('public')->exists($materi->konten)) {
Storage::disk('public')->delete($materi->konten);
}
$data['konten'] = $request->file('konten')->store('materi', 'public');
}
if ($request->hasFile('audio')) {
if ($materi->audio && Storage::disk('public')->exists($materi->audio)) {
Storage::disk('public')->delete($materi->audio);
}
$data['audio'] = $request->file('audio')->store('audio', 'public');
}
DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->update($data);
return redirect()->route('adminmateri.index')->with('success', 'Materi berhasil diperbarui.');
}
public function destroy($id_style, $id_materi)
{
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if ($materi) {
if ($materi->konten && Storage::disk('public')->exists($materi->konten)) {
Storage::disk('public')->delete($materi->konten);
}
if ($materi->audio && Storage::disk('public')->exists($materi->audio)) {
Storage::disk('public')->delete($materi->audio);
}
DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->delete();
return redirect()->route('adminmateri.index')->with('success', 'Materi berhasil dihapus.');
}
return redirect()->route('adminmateri.index')->with('error', 'Materi tidak ditemukan.');
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use App\Models\Periode;
use App\Models\PilihPeriode;
use Illuminate\Http\Request;
class AdminPeriodController extends Controller
{
public function index()
{
$periods = Periode::orderBy('id', 'desc')->get();
$selectPeriod = PilihPeriode::first();
if (!$selectPeriod->id_periode) {
$selectPeriod->id_periode = 'Belum Ditambahkan';
} else {
$checkPeriod = Periode::findOrFail($selectPeriod->id_periode);
if ($checkPeriod->semester == 1) {
$checkPeriod->semester = 'Ganjil';
} else {
$checkPeriod->semester = 'Genap';
}
$selectPeriod->period = $checkPeriod->semester . ' ' . $checkPeriod->tahun;
}
return view('admin_backend.admin_period', compact('periods', 'selectPeriod'));
}
public function store(Request $request)
{
$semester = $request->semester;
$tahunAwal = $request->tahun_awal;
$tahunAkhir = $request->tahun_akhir;
$tahun = $tahunAwal . '/' . $tahunAkhir;
$checkPeriod = Periode::where('semester', $semester)->where('tahun', $tahun)->count();
if ($checkPeriod > 0) {
return redirect()->route('adminPeriod.index')->with('error', 'Gagal, periode yang anda buat sudah ada');
}
if ($tahunAkhir - $tahunAwal != 1) {
return redirect()->route('adminPeriod.index')->with('error', 'Gagal, tahun yang anda masukkan tidak valid');
}
Periode::create([
'semester' => $request->semester,
'tahun' => $tahun
]);
return redirect()->route('adminPeriod.index')->with('success', 'Periode semester baru berhasil dibuat');
}
public function update(Request $request, $id)
{
$semester = $request->semester;
$tahunAwal = $request->tahun_awal;
$tahunAkhir = $request->tahun_akhir;
$tahun = $tahunAwal . '/' . $tahunAkhir;
$checkPeriod = Periode::where('semester', $semester)->where('tahun', $tahun)->count();
if ($checkPeriod > 0) {
return redirect()->route('adminPeriod.index')->with('error', 'Gagal, periode yang anda buat sudah ada');
}
if ($tahunAkhir - $tahunAwal != 1) {
return redirect()->route('adminPeriod.index')->with('error', 'Gagal, tahun yang anda masukkan tidak valid');
}
$period = Periode::findOrFail($id);
$period->semester = $semester;
$period->tahun = $tahun;
$period->update();
return redirect()->route('adminPeriod.index')->with('success', 'Periode tersebut telah diubah');
}
public function destroy($id)
{
$period = Periode::findOrFail($id);
$result = Hasil::where('id_periode', $id)->first();
if (empty($result)) {
$period->delete();
return redirect()->route('adminPeriod.index')->with('success', 'Periode tersebut telah dihapus');
}
return redirect()->route('adminPeriod.index')->with('error', 'Gagal, periode tersebut memiliki hasil kuesioner');
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AdminProfileController extends Controller
{
public function index()
{
return view('admin_backend.admin_profile');
}
public function update(Request $request)
{
// Validate the request data (you can add more validation rules)
$validatedData = $request->validate([
'nama_lengkap' => 'required',
'nim' => 'required',
'profile_image' => 'image|mimes:jpeg,png,jpg,gif|max:2048',
]);
$imagePath = null;
if ($request->hasFile('profile_image')) {
$image = $request->file('profile_image');
$imagePath = $image->store('images', 'public');
}
$user = User::findOrFail(auth()->user()->id);
$user->nama_lengkap = $request->input('nama_lengkap');
$user->nim = $request->input('nim');
if ($imagePath != null) {
$user->foto = $imagePath;
}
$user->update();
return redirect('/admin')->with('success', 'Profile updated successfully');
}
public function changePassword(Request $request)
{
$request->validate([
'current_password' => 'required',
'new_password' => 'required|string|min:8|confirmed',
], [
'new_password.min' => 'Password tidak boleh kurang dari 8 karakter',
]);
$user = Auth::user();
// Verify the current password using the fully qualified namespace
if (!\Illuminate\Support\Facades\Hash::check($request->input('current_password'), $user->password)) {
return redirect()->back()->with('error', 'Current password is incorrect');
}
// Update the password
$user->password = \Illuminate\Support\Facades\Hash::make($request->input('new_password'));
$user->save();
return redirect()->back()->with('success', 'Password changed successfully');
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\Kuesioner;
use Illuminate\Http\Request;
class AdminQuestionnaireController extends Controller
{
public function index()
{
$kuesioners = Kuesioner::get();
return view('admin_backend.admin_questionnaire', compact('kuesioners'));
}
public function store(Request $request)
{
Kuesioner::create([
'kategori_soal' => $request->create_kategori,
'soal' => $request->create_soal,
]);
return redirect()->route('adminQuestionnaire.index')->with('success', 'Soal berhasil disimpan');
}
public function update(Request $request, $admin_questionnaire)
{
$kuesioner = Kuesioner::findOrFail($admin_questionnaire);
$kuesioner->kategori_soal = $request->edit_kategori;
$kuesioner->soal = $request->edit_soal;
$kuesioner->update();
return redirect()->route('adminQuestionnaire.index')->with('success', 'Soal berhasil diubah');
}
public function destroy($admin_questionnaire)
{
$kuesioner = Kuesioner::findOrFail($admin_questionnaire);
$kuesioner->delete();
return redirect()->route('adminQuestionnaire.index')->with('success', 'Soal telah dihapus');
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use Barryvdh\DomPDF\Facade\Pdf as FacadePdf;
use Barryvdh\DomPDF\PDF as DomPDFPDF;
use Illuminate\Http\Request;
use Carbon\Carbon;
class AdminResultController extends Controller
{
public function index()
{
$results = Hasil::with('user')->with('periode')->get();
$results = $results->map(function ($result) {
$result->formatted_created_at = Carbon::parse($result->created_at)->format('d M Y');
if ($result->periode->semester == 1) {
$result->periode->semester = 'Ganjil';
} else {
$result->periode->semester = 'Genap';
}
return $result;
});
return view('admin_backend.admin_result', compact('results'));
}
public function show($id)
{
$result = Hasil::with('user')->findOrFail($id);
$result->formatted_created_at = Carbon::parse($result->created_at)->format('d M Y');
return view('admin_backend.admin_pdf_result', compact('result'));
}
public function cetak_pdf($id)
{
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class ListAdminController extends Controller
{
//
public function index()
{
$users = User::all()->whereIn('kelas_user', ['1','2']);
return view('admin_backend.admin_listadmin', compact('users'));
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'nama_lengkap' => ['required', 'string', 'max:255'],
'nim' => ['required', 'string', 'max:20'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
public function store(Request $request)
{
User::create([
'nama_lengkap' =>$request->nama_lengkap,
'nim' => $request->nim,
'email' => $request->email,
'password' => Hash::make($request->password),
'foto' => 'images/2xUcdtkygOf0aM2EvXuKFLXLOBlEuXNPT21Oeo15.png',
'kelas_user' => '2'
]);
return redirect()->route('adminListAdmin.index')->with('success', 'Admin baru berhasil dibuat');
}
public function update(Request $request, $id)
{
$nama_lengkap = $request->nama_lengkap;
$nim = $request->nim;
$email = $request->email;
$user = User::findOrFail($id);
$user->nama_lengkap = $nama_lengkap;
$user->nim = $nim;
$user->email = $email;
$user->update();
return redirect()->route('adminListAdmin.index')->with('success', 'Admin tersebut telah diubah');
}
public function destroy($id)
{
$user = User::findOrFail($id);
$user->delete();
return redirect()->route('adminListAdmin.index')->with('success', 'Admin tersebut telah dihapus');
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\Adminbackend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use App\Models\User;
use Illuminate\Http\Request;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class ListUserController extends Controller
{
//
public function index()
{
$users = User::all()->where('kelas_user', '3');
return view('admin_backend.admin_listuser', compact('users'));
}
// /**
// * Get a validator for an incoming registration request.
// *
// * @param array $data
// * @return \Illuminate\Contracts\Validation\Validator
// */
public function store(Request $request)
{
$user = new User();
$user->nama_lengkap = $request->input('nama_lengkap');
$user->nim = $request->input('nim');
$user->semester = $request->input('semester');
$user->angkatan = $request->input('angkatan');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('email'));
$user->kelas_user = '3';
// Setel atribut-atribut lain yang perlu diisi
$user->save();
return response()->json(['message' => 'User ditambahkan'], 201);
}
public function destroy($id)
{
$user = User::findOrFail($id);
$user->delete();
Hasil::where('id_user', $id)->delete();
return redirect()->route('adminListUser.index')->with('success', 'User tersebut telah dihapus');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\AdminBackend;
use App\Http\Controllers\Controller;
use App\Models\PilihPeriode;
use Illuminate\Http\Request;
class SelectPeriodController extends Controller
{
public function update(Request $request)
{
$id = $request->id_periode;
$pilihPeriode = PilihPeriode::first();
if ($pilihPeriode->id_periode == $id) {
return redirect()->route('adminPeriod.index')->with('error', 'Periode kuesioner yang dipilih sama dengan sebelumnya');
}
$pilihPeriode->id_periode = $id;
$pilihPeriode->aktif = '0';
$pilihPeriode->update();
return redirect()->route('adminPeriod.index')->with('success', 'Periode kuesioner telah diubah');
}
public function active(Request $request)
{
$pilihPeriode = PilihPeriode::first();
$pilihPeriode->aktif = $request->optionActive;
$pilihPeriode->update();
return redirect()->route('adminPeriod.index')->with('success', 'Periode kuesioner telah diubah');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Laravel\Socialite\Facades\Socialite;
use App\Models\User;
use Illuminate\Support\Str;
class GoogleController extends Controller
{
public function redirectToGoogle()
{
return Socialite::driver('google')->redirect();
}
public function handleGoogleCallback()
{
try {
$googleUser = Socialite::driver('google')->stateless()->user();
$user = User::where('email', $googleUser->getEmail())->first();
if (!$user) {
// Buat user baru jika belum ada
$user = User::create([
'name' => $googleUser->getName(),
'email' => $googleUser->getEmail(),
'password' => bcrypt(Str::random(16)), // random password
]);
}
Auth::login($user);
return redirect()->intended('/dashboard'); // arahkan setelah login
} catch (\Exception $e) {
return redirect()->route('login')->with('error', 'Gagal login dengan Google.');
}
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class RegisterController extends Controller
{
public function register(Request $request)
{
// Validasi data
$validated = $request->validate([
'nama_lengkap' => 'required|string|max:255',
'nim' => 'required|string|max:50|unique:users,nim',
'semester' => 'required|numeric|min:1',
'angkatan' => 'required|numeric|min:2000|max:' . date('Y'),
'email' => [
'required',
'email',
'max:255',
'unique:users,email',
// Validasi regex domain email
'regex:/^[a-zA-Z0-9._%+-]+@(polije\.ac\.id|student\.polije\.ac\.id)$/'
],
'password' => 'required|string|min:8|confirmed',
], [
'email.regex' => 'Email harus menggunakan domain @polije.ac.id atau @student.polije.ac.id.',
]);
// Simpan ke database
$user = User::create([
'nama_lengkap' => $validated['nama_lengkap'],
'nim' => $validated['nim'],
'semester' => $validated['semester'],
'angkatan' => $validated['angkatan'],
'email' => $validated['email'],
'password' => Hash::make($validated['password']),
'kelas_user' => 3,
'foto' => 'images/defaultProfile.jpg',
]);
DB::table('hasil')->insert([
'id_user' => $user->id,
'created_at' => now(),
]);
// Redirect ke halaman yang diinginkan
return redirect()->route('login')->with('success', 'Pendaftaran berhasil!');
}
public function showRegistrationForm()
{
return view('auth.register'); // pastikan nama view sesuai
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AuditoryController extends Controller
{
public function index()
{
// Ambil data materi berdasarkan id_style = 2 (Auditory)
$materi = DB::table('materi')
->where('id_style', 2)
->orderBy('id_materi')
->select('id_materi', 'konten', 'audio', 'teks')
->get();
return view('backend.materi.' . $bladeMap[$style]);
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Hasil;
use App\Models\User;
use App\Models\PilihPeriode;
use Barryvdh\DomPDF\Facade\Pdf as FacadePdf;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class DashboardController extends Controller
{
public function index()
{
$kmCounts = Hasil::select('km_class', DB::raw('count(*) as total'))
->groupBy('km_class')
->orderByRaw("FIELD(km_class, 'High', 'Medium', 'Low')")
->get();
$rmCounts = Hasil::select('rm_class', DB::raw('count(*) as total'))
->groupBy('rm_class')
->orderByRaw("FIELD(rm_class, 'High', 'Medium', 'Low')")
->get();
$checkPeriod = PilihPeriode::first();
$idUser = auth()->user()->id;
$historiPengisian = Hasil::where('id_user', $idUser)
->where('id_periode', $checkPeriod->id_periode)
->get();
$results = Hasil::with('user')->with('periode')
->where('id_user', $idUser)
->get()
->map(function ($result) {
$result->formatted_created_at = Carbon::parse($result->created_at)->format('d M Y');
$result->periode->semester = $result->periode->semester == 1 ? 'Ganjil' : 'Genap';
return $result;
});
// Ambil hasil terakhir dari user untuk gaya belajar
$hasilGayaBelajar = Hasil::where('id_user', $idUser)
->where('id_periode', $checkPeriod->id_periode)
->latest()
->first();
$learningStyleMap = [
1 => 'Visual',
2 => 'Auditory',
3 => 'Read / Write',
4 => 'Kinesthetic',
5 => 'Multimodal'
];
$learningStyle = $hasilGayaBelajar
? ($learningStyleMap[$hasilGayaBelajar->id_style] ?? 'Tidak diketahui')
: 'Belum tersedia';
// ===== LOGIKA UNTUK POPUP KUESIONER =====
$data = DB::table('hasil')
->where('id_user', $idUser)
->where('id_periode', $checkPeriod->id_periode)
->latest()
->first();
$styles = [
'Visual' => $data->visual ?? 0,
'Auditory' => $data->auditory ?? 0,
'Read/Write' => $data->readwrite ?? 0,
'Kinesthetic' => $data->kinesthetic ?? 0,
];
$perluIsiKuesioner = empty(array_filter($styles)); // semua 0 → true
return view('backend.dashboard', compact(
'kmCounts',
'rmCounts',
'historiPengisian',
'results',
'learningStyle',
'perluIsiKuesioner'
));
}
public function show($id)
{
$result = Hasil::with('user')->findOrFail($id);
$result->formatted_updated_at = Carbon::parse($result->updated_at)->format('d M Y');
return view('backend.user_pdf_result', compact('result'));
}
public function cetak_pdf($id)
{
// Kosong / belum diimplementasikan
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Hasil;
use Illuminate\Support\Facades\Auth;
class HistoryController extends Controller
{
public function index()
{
$userId = Auth::id();
$hasilTerbaru = Hasil::where('id_user', $userId)
->orderBy('created_at', 'desc')
->first();
$TOTAL_SOAL = 16;
if ($hasilTerbaru) {
$vark = [
'Visual' => $hasilTerbaru->visual ?? 0,
'Auditory' => $hasilTerbaru->auditory ?? 0,
'Read/Write' => $hasilTerbaru->readwrite ?? 0,
'Kinesthetic' => $hasilTerbaru->kinesthetic ?? 0,
];
$jumlahJawaban = array_sum($vark);
$persen = round(($jumlahJawaban / $TOTAL_SOAL) * 100);
$max = max($vark);
$tertinggi = array_keys($vark, $max);
$gayaBelajar = count($tertinggi) > 1 ? 'Multimodal' : $tertinggi[0];
} else {
$hasilTerbaru = null;
$persen = 0;
$gayaBelajar = '-';
$jumlahJawaban = 0;
}
return view('backend.history_quis', compact('hasilTerbaru', 'persen', 'gayaBelajar', 'TOTAL_SOAL', 'jumlahJawaban'));
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
class InstruksiController extends Controller
{
public function tampilkanInstruksiByStyle($style, $id_materi)
{
$styleMap = [
'visual' => 1,
'auditory' => 2,
'readwrite' => 3,
'kinesthetic' => 4,
];
if (!isset($styleMap[$style])) {
abort(404, 'Style tidak valid');
}
$id_style = $styleMap[$style];
// Ambil semua instruksi berdasarkan id_style SAJA
$instruksi = DB::table('instruksi')
->where('id_style', $id_style)
->orderBy('id_instruksi')
->pluck('instruksi');
// Kirim juga id_materi jika diperlukan di tampilan
return view("backend.materi.$style", compact('instruksi', 'id_materi'));
}
}

View File

@ -0,0 +1,168 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Models\Hasil;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class KuesionerLSController extends Controller
{
public function store(Request $request)
{
$mappings = [
1 => [
"Mencari tahu tokonya apakah ada di suatu tempat yang saya ketahui" => 'K',
"Tanya arah jalan kepada teman" => 'A',
"Menulis petunjuk jalan" => 'R',
"Menggunakan Peta atau Layanan Maps" => 'V'
],
2 => [
"Melihat diagramnya" => 'V',
"Mendengarkan penjelasan orang tersebut" => 'A',
"Membaca kata-kata yang tampil di video" => 'R',
"Melakukan tindakan apa yang dilakukan oleh orang dalam video" => 'K'
],
3 => [
"Melihat hal-hal menarik pada tur tersebut" => 'K',
"Menggunakan peta atau layanan maps dan melihat lokasi yang akan dituju" => 'V',
"Membaca detail tur pada dokumen atau rencana tur" => 'R',
"Berdiskusi dengan teman atau penyelenggara tur yang merencanakan tur tersebut" => 'A'
],
4 => [
"Saya akan menerapkan ilmu yang saya punya pada dunia kerja nanti" => 'K',
"Saya akan bercakap dengan rekan kerja saat berdiskusi" => 'A',
"Saya akan menggunakan gambar atau video untuk menunjukkan pekerjaan saya kepada rekan kerja" => 'V',
"Saya akan menerapkan kata-kata yang baik saat mengirimkan pesan kepada rekan kerja" => 'R'
],
5 => [
"Saya suka berdiskusi" => 'A',
"Saya suka melihat pola dari apa yang saya pelajari" => 'V',
"Saya suka mencari contoh dari apa yang saya pelajari" => 'K',
"Saya suka membaca buku atau artikel" => 'R'
],
6 => [
"Melakukan riset dan perbandingan langsung di lokasi" => 'K',
"Membaca brosur yang berisi daftar barang yang saya cari" => 'R',
"Melihat ulasan di YouTube atau Media Sosial" => 'V',
"Berdiskusi dengan pakar" => 'A'
],
7 => [
"Melihat teman saya bermain catur dan memperhatikannya" => 'K',
"Mendengarkan penjelasan ahli tentang bagaimana aturan permainan" => 'A',
"Melihat tutorial di YouTube" => 'V',
"Membaca instruksi tertulis dari permainan catur" => 'R'
],
8 => [
"Memberi saya buku atau data tentang penyakit jantung yang saya alami" => 'R',
"Menggunakan alat peraga guna menjelaskan apa masalah jantung yang saya alami" => 'K',
"Saya ingin dokter menjelaskan tentang penyakit saya" => 'A',
"Menunjukkan grafik dan statistik dari penyakit jantung yang saya alami" => 'V'
],
9 => [
"Membaca instruksi yang muncul saat saya menjalankan aplikasi tersebut" => 'R',
"Berdiskusi dengan seseorang yang paham fungsi dan kegunaan dari aplikasi tersebut" => 'A',
"Saya langsung mencoba berbagai tombol pada aplikasi tersebut" => 'K',
"Saya melihat gambar atau video yang menjelaskan tentang aplikasi tersebut" => 'V'
],
10 => [
"Video pendek atau video panjang" => 'K',
"Interaksi pada desain yang menarik" => 'V',
"Artikel atau buku digital" => 'R',
"Radio atau Podcast" => 'A'
],
11 => [
"Diagram tahapan proyek" => 'V',
"Laporan proyek yang sedang dikerjakan" => 'R',
"Kesempatan untuk membahas proyek dengan manajer proyek" => 'A',
"Contoh nyata terhadap proyek sejenis yang sukses" => 'K'
],
12 => [
"Bertanya kepada seseorang mengenai fitur dan apa yang bisa kamera tersebut lakukan" => 'A',
"Membaca buku instruksi pada kotak kamera tentang bagaimana penggunaan yang benar" => 'R',
"Melihat ulasan dari seseorang yang membahas mengenai kamera tersebut" => 'V',
"Mengambil langsung beberapa foto dan membandingkannya untuk mendapat hasil terbaik" => 'K'
],
13 => [
"Demonstrasi, model atau praktek langsung" => 'K',
"Tanya jawab dan berdiskusi" => 'A',
"Buku, artikel, novel atau bahan bacaan" => 'R',
"Grafik, diagram, peta atau video" => 'V'
],
14 => [
"Mencontohkan dari apa yang saya lakukan" => 'K',
"Mencatat hasil yang saya peroleh" => 'R',
"Seseorang yang mengatakan umpan balik langsung kepada saya" => 'A',
"Menggunakan diagram atau video hasil dari apa yang saya lakukan" => 'V'
],
15 => [
"Menonton video atau rekaman ulasan dari seseorang yang mengunggahnya" => 'K',
"Berdiskusi dengan pemilik langsung di lokasi" => 'A',
"Membaca deskripsi mengenai fitur dan fasilitas yang diberikan" => 'R',
"Menggunakan layanan maps untuk mencari lokasi" => 'V'
],
16 => [
"Video tutorial yang menunjukkan setiap tahapan perakitan" => 'V',
"Saran dari seseorang yang berhasil melakukannya" => 'A',
"Petunjuk tertulis yang disertakan dalam paket pembelian" => 'R',
"Mencoba merakitnya langsung secara perlahan" => 'K'
]
];
$visual = $auditory = $readwrite = $kinesthetic = 0;
for ($i = 1; $i <= 16; $i++) {
$answer = $request->input("soal{$i}");
if ($answer && isset($mappings[$i]) && in_array($answer, $mappings[$i])) {
switch ($answer) {
case 'V': $visual++; break;
case 'A': $auditory++; break;
case 'R': $readwrite++; break;
case 'K': $kinesthetic++; break;
}
}
}
$percentages = [
'Visual' => $visual / 16 * 100,
'Auditory' => $auditory / 16 * 100,
'Read/Write' => $readwrite / 16 * 100,
'Kinesthetic' => $kinesthetic / 16 * 100,
];
arsort($percentages);
$values = array_values($percentages);
$keys = array_keys($percentages);
$result = 'Multimodal';
if ($values[0] - $values[1] >= 10) {
$result = $keys[0];
}
$id_style = match ($result) {
'Visual' => 1,
'Auditory' => 2,
'Read/Write' => 3,
'Kinesthetic' => 4,
default => 5, // Multimodal
};
Hasil::updateOrCreate(
['id_user' => Auth::id()],
[
'visual' => $visual,
'auditory' => $auditory,
'readwrite' => $readwrite,
'kinesthetic' => $kinesthetic,
'id_style' => $id_style,
'result' => $result,
]
);
return redirect()->route('kuesioner-mai')->with('success', 'Jawaban kuesioner berhasil disimpan!');
}
}

View File

@ -0,0 +1,150 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Models\Hasil;
use App\Models\KuesionerLearningStyle;
use App\Models\KuesionerMetakognitif;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class KuesionerMetaController extends Controller
{
public function showquestion()
{
$questions = [
"Saya bertanya kepada diri sendiri, “Apakah saya sudah mencapai tujuan saya?” ketika sedang berupaya mencapai tujuan secara intensif.",
"Saya mempertimbangkan berbagai pilihan sebelum saya menyelesaikan sebuah permasalahan.",
"Saya coba menggunakan cara-cara yang pernah saya pakai sebelumnya.",
"Saya terus menerus mengatur diri selama belajar agar memiliki waktu yang cukup.",
"Saya memahami kekuatan dan kelemahan kecerdasan saya.",
"Saya berpikir tentang apa yang sebenarnya perlu saya pelajari sebelum mengerjakan tugas.",
"Saya menyadari bagaimana baiknya saya menyelesaikan suatu tes.",
"Saya menyusun tujuan-tujuan khusus sebelum saya mengerjakan tugas.",
"Saya bertindak perlahan-lahan dan hati-hati bila mana menjumpai informasi penting.",
"Saya mengetahui macam informasi apa yang paling penting untuk dipelajari.",
"Saya bertanya kepada diri sendiri ketika mempertimbangkan seluruh pilihan untuk memecahkan suatu masalah.",
"Saya terampil/mahir menyusun dan merangkai suatu informasi.",
"Saya secara sadar memusatkan perhatian kepada informasi yang penting.",
"Untuk tiap cara yang saya gunakan, saya mempunyai maksud tertentu.",
"Saya belajar paling baik ketika saya mengetahui topik pembelajaran itu.",
"Saya mengetahui apa yang diharapkan guru untuk saya pelajari.",
"Saya mudah mengingat informasi.",
"Saya menggunakan cara belajar yang berbeda-beda tergantung pada situasi dan kondisi.",
"Setelah saya menyelesaikan suatu tugas, saya bertanya kepada diri sendiri apakah ada cara yang lebih mudah.",
"Saya mengendalikan sendiri kualitas belajar saya.",
"Secara teratur saya melakukan peninjauan kemampuan untuk menolong saya memahami hubungan-hubungan penting.",
"Sebelum memulai sesuatu, saya bertanya kepada diri sendiri tentang hal-hal terkait.",
"Saya mempertimbangkan berbagai cara untuk memecahkan sesuatu masalah sebelum akhirnya memutuskan salah satu diantaranya.",
"Setiap kali selesai belajar, saya membuat rangkuman.",
"Saya menanyakan orang lain bilamana saya tidak memahami sesuatu.",
"Saya dapat memotivasi diri untuk belajar bilamana diperlukan.",
"Saya menyadari cara apa yang digunakan ketika saya belajar.",
"Saya biasa memikirkan manfaat cara-cara belajar yang saya pakai.",
"Saya memanfaatkan kekuatan kecerdasan saya untuk menutupi kekurangan saya.",
"Saya memusatkan perhatian terhadap arti dan manfaat dari informasi yang baru.",
"Saya menemukan contoh-contoh sendiri sehingga informasi menjadi lebih bermakna atau jelas.",
"Saya tergolong adil menilai diri sendiri tentang seberapa baiknya saya memahami sesuatu.",
"Secara otomatis saya sadar menggunakan cara belajar yang berguna.",
"Secara teratur saya istirahat sebentar untuk mengatur pemahaman saya.",
"Saya menyadari/mengetahui bahwa setiap cara yang saya gunakan adalah yang paling efektif atau tepat.",
"Saya bertanya kepada diri sendiri tentang seberapa baik saya mencapai tujuan setelah menyelesaikan tugas.",
"Saya membuat gambar atau bagan untuk menolong saya selama belajar.",
"Saya bertanya kepada diri sendiri apakah saya telah mempertimbangkan semua pilihan, setiap kali saya memecahkan suatu masalah.",
"Saya berupaya memahami informasi baru dengan kata-kata saya sendiri.",
"Saya mengubah cara jika saya gagal memahami.",
"Saya menggunakan urutan topik/materi dari buku/teks untuk membantu saya belajar.",
"Saya membaca petunjuk secara teliti sebelum memulai melakukan suatu tugas.",
"Saya bertanya kepada diri sendiri apakah hal yang sedang dibaca berhubungan dengan apa yang telah saya ketahui.",
"Saya memikirkan kembali anggapan saya ketika saya bingung.",
"Saya mengatur waktu saya untuk mencapai tujuan sebaik-baiknya.",
"Saya lebih banyak belajar jika saya tertarik/senang dengan topik.",
"Saya berupaya membagi kegiatan belajar saya menjadi langkah-langkah yang lebih kecil.",
"Saya lebih memperhatikan makna umum dari pada makna khusus.",
"Saya bertanya kepada diri sendiri tentang seberapa baik saya bekerja, pada waktu mempelajari sesuatu yang baru.",
"Saya bertanya kepada diri sendiri apakah saya belajar sebanyak yang saya mampu, setiap kali saya menyelesaikan tugas.",
"Saya melupakan informasi baru yang tidak jelas.",
"Saya berhenti dan selanjutnya membaca kembali jika saya bingung."
];
return view('backend.main.kuesioner.kuesioner_metacognitive', compact('questions'));
}
public function store(Request $request)
{
if (!Auth::check()) {
return redirect()->route('login')->with('error', 'Silakan login terlebih dahulu.');
}
$user = Auth::user();
$answers = [];
for ($i = 1; $i <= 52; $i++) {
$answers["soal{$i}"] = $request->input("soal{$i}", 0);
}
// Hitung skor indikator
$indicator_scores = [
'declarative_knowledge' => array_sum(array_intersect_key($answers, array_flip(['soal5', 'soal10', 'soal12', 'soal16', 'soal17', 'soal20', 'soal32', 'soal46']))),
'procedural_knowledge' => array_sum(array_intersect_key($answers, array_flip(['soal3', 'soal14', 'soal27', 'soal33']))),
'conditional_knowledge' => array_sum(array_intersect_key($answers, array_flip(['soal15', 'soal18', 'soal26', 'soal29', 'soal35']))),
'planning' => array_sum(array_intersect_key($answers, array_flip(['soal4', 'soal6', 'soal8', 'soal22', 'soal23', 'soal42', 'soal45']))),
'information_management' => array_sum(array_intersect_key($answers, array_flip(['soal9', 'soal13', 'soal30', 'soal31', 'soal37', 'soal39', 'soal41', 'soal43', 'soal47', 'soal48']))),
'monitoring' => array_sum(array_intersect_key($answers, array_flip(['soal1', 'soal2', 'soal11', 'soal21', 'soal28', 'soal34', 'soal49']))),
'debugging' => array_sum(array_intersect_key($answers, array_flip(['soal25', 'soal40', 'soal44', 'soal51', 'soal52']))),
'evaluation' => array_sum(array_intersect_key($answers, array_flip(['soal7', 'soal19', 'soal24', 'soal36', 'soal38', 'soal50']))),
];
// Hitung total dan klasifikasi
$km_total = $indicator_scores['declarative_knowledge'] + $indicator_scores['procedural_knowledge'] + $indicator_scores['conditional_knowledge'];
$rm_total = $indicator_scores['planning'] + $indicator_scores['information_management'] + $indicator_scores['monitoring'] + $indicator_scores['debugging'] + $indicator_scores['evaluation'];
$km_class = ($km_total >= 63) ? 'high' : (($km_total >= 42) ? 'med' : 'low');
$rm_class = ($rm_total >= 132) ? 'high' : (($rm_total >= 88) ? 'med' : 'low');
$lv_meta = (($rm_class == 'high' && ($km_class == 'high' || $km_class == 'med')) ||
($rm_class == 'med' && ($km_class == 'high' || $km_class == 'med'))) ? 2 : 1;
// Tentukan kategori
$category = 4;
switch (true) {
case ($lv_meta == 1 && $km_class == 'low' && $rm_class == 'low'): $category = 1; break;
case ($lv_meta == 1 && $km_class == 'low' && $rm_class == 'med'): $category = 2; break;
case ($lv_meta == 1 && $km_class == 'low' && $rm_class == 'high'): $category = 3; break;
case ($lv_meta == 1 && $km_class == 'med' && $rm_class == 'low'): $category = 4; break;
case ($lv_meta == 2 && $km_class == 'med' && $rm_class == 'med'): $category = 5; break;
case ($lv_meta == 2 && $km_class == 'med' && $rm_class == 'high'): $category = 6; break;
case ($lv_meta == 2 && $km_class == 'high' && $rm_class == 'med'): $category = 7; break;
case ($lv_meta == 2 && $km_class == 'high' && $rm_class == 'high'): $category = 8; break;
}
// Simpan ke tabel hasil (update sebagian kolom saja)
Hasil::where('id_user', $user->id)->update([
'declarative_knowledge' => $indicator_scores['declarative_knowledge'],
'procedural_knowledge' => $indicator_scores['procedural_knowledge'],
'conditional_knowledge' => $indicator_scores['conditional_knowledge'],
'planning' => $indicator_scores['planning'],
'information_management' => $indicator_scores['information_management'],
'monitoring' => $indicator_scores['monitoring'],
'debugging' => $indicator_scores['debugging'],
'evaluation' => $indicator_scores['evaluation'],
'km_total' => $km_total,
'rm_total' => $rm_total,
'km_class' => $km_class,
'rm_class' => $rm_class,
'category' => $category,
]);
// Ambil hasil untuk ditampilkan
$kuesionerls = Hasil::where('id_user', $user->id)->first();
$kuesionermeta = Hasil::where('id_user', $user->id)->where('category', $category)->first();
// return view('backend.main.kuesioner.kuesioner_hasil', compact('kuesionerls', 'kuesionermeta'));
return redirect()->route('history_quis.index')->with('success', 'Kuesioner berhasil disimpan.');
}
}

View File

@ -0,0 +1,256 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use App\Models\Materi;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class MateriController extends Controller
{
public function index()
{
$userId = Auth::id();
$data = DB::table('hasil')->where('id_user', $userId)->first();
if (!$data) {
return view('backend.materipembelajaran', [
'topStyles' => [],
'isMultimodal' => false,
'alternativeStyles' => [],
'isEmpty' => true
]);
}
$styles = [
'Visual' => $data->visual ?? 0,
'Auditory' => $data->auditory ?? 0,
'Read/ Write' => $data->readwrite ?? 0,
'Kinesthetic' => $data->kinesthetic ?? 0,
];
$maxValue = max($styles);
$topStyles = array_keys($styles, $maxValue);
$isMultimodal = count($topStyles) > 1;
$alternativeStyles = array_diff(array_keys($styles), $topStyles);
$isEmpty = empty(array_filter($styles));
return view('backend.materipembelajaran', compact('topStyles', 'isMultimodal', 'alternativeStyles', 'isEmpty'));
}
public function showByStyle($style)
{
$userId = Auth::id();
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
if (!$hasil) {
return redirect()->route('user.questionnaire.check')->with('error', 'Silakan isi kuesioner terlebih dahulu untuk mengakses materi.');
}
$bladeMap = [
'visual' => 'visual',
'auditory' => 'auditory',
'read-write' => 'readwrite',
'kinesthetic' => 'kinesthetic',
];
$style = strtolower($style);
if (!array_key_exists($style, $bladeMap)) {
abort(404);
}
$id_style_map = [
'visual' => 1,
'auditory' => 2,
'read-write' => 3,
'kinesthetic' => 4,
];
$id_style = $id_style_map[$style];
$materi = DB::table('materi')
->where('id_style', $id_style)
->orderBy('id_materi')
->select('id_materi', 'konten', 'audio', 'teks', 'rangkuman')
->get();
return view('backend.materi.' . $bladeMap[$style], compact('materi'));
}
public function visual($id_materi)
{
$userId = Auth::id();
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
if (!$hasil || ($hasil->visual == 0 && $hasil->auditory == 0 && $hasil->readwrite == 0 && $hasil->kinesthetic == 0)) {
return redirect('/materi')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
}
$id_style = 1;
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
abort(404, 'Materi tidak ditemukan');
}
$next = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '>', $id_materi)->orderBy('id_materi')->first();
$prev = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '<', $id_materi)->orderByDesc('id_materi')->first();
$instruksi = DB::table('instruksi')->where('id_style', $id_style)->orderBy('id_instruksi')->pluck('instruksi');
return view('backend.materi.visual', compact('materi', 'next', 'prev', 'instruksi'));
}
public function auditory($id_materi)
{
$userId = Auth::id();
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
if (!$hasil || ($hasil->visual == 0 && $hasil->auditory == 0 && $hasil->readwrite == 0 && $hasil->kinesthetic == 0)) {
return redirect('/materi')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
}
$id_style = 2;
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
abort(404, 'Materi tidak ditemukan');
}
$next = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '>', $id_materi)->orderBy('id_materi')->first();
$prev = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '<', $id_materi)->orderByDesc('id_materi')->first();
$instruksi = DB::table('instruksi')->where('id_style', $id_style)->orderBy('id_instruksi')->pluck('instruksi');
return view('backend.materi.auditory', compact('materi', 'next', 'prev', 'instruksi'));
}
public function readwrite($id_materi)
{
$userId = Auth::id();
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
if (!$hasil || ($hasil->visual == 0 && $hasil->auditory == 0 && $hasil->readwrite == 0 && $hasil->kinesthetic == 0)) {
return redirect('/materi')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
}
$id_style = 3;
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
abort(404, 'Materi tidak ditemukan');
}
$next = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '>', $id_materi)->orderBy('id_materi')->first();
$prev = DB::table('materi')->where('id_style', $id_style)->where('id_materi', '<', $id_materi)->orderByDesc('id_materi')->first();
$rangkuman = $hasil->rangkuman;
$instruksi = DB::table('instruksi')->where('id_style', $id_style)->orderBy('id_instruksi')->pluck('instruksi');
return view('backend.materi.readwrite', compact('materi', 'next', 'prev', 'rangkuman', 'instruksi'));
}
public function kinesthetic($id_materi)
{
$userId = Auth::id();
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
if (!$hasil || ($hasil->visual == 0 && $hasil->auditory == 0 && $hasil->readwrite == 0 && $hasil->kinesthetic == 0)) {
return redirect('/materi')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
}
$id_style = 4;
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
abort(404, 'Materi tidak ditemukan');
}
$instruksi = DB::table('instruksi')->where('id_style', $id_style)->orderBy('id_instruksi')->pluck('instruksi');
return view('backend.materi.kinesthetic', compact('materi', 'instruksi'));
}
public function submitRangkuman(Request $request)
{
$request->validate([
'rangkuman' => 'required|string|max:10000',
]);
$id_user = auth()->id();
DB::table('hasil')->updateOrInsert(
['id_user' => $id_user],
['rangkuman' => $request->rangkuman, 'updated_at' => now()]
);
return redirect()->back()->with('success', 'Rangkuman berhasil dikirim!');
}
public function submitKinesthetic(Request $request, $id_materi)
{
$id_style = 4;
$materi = DB::table('materi')
->where('id_style', $id_style)
->where('id_materi', $id_materi)
->first();
if (!$materi) {
return response()->json(['status' => 'error', 'output' => 'Materi tidak ditemukan.']);
}
$code = $request->input('code');
$response = Http::post('https://emkc.org/api/v2/piston/execute', [
'language' => 'java',
'version' => '15.0.2',
'files' => [
['name' => 'Main.java', 'content' => $code],
],
]);
if (!$response->ok()) {
return response()->json(['status' => 'error', 'output' => 'Gagal memanggil API Piston']);
}
$result = $response->json();
function normalizeOutput($text) {
$text = str_replace(["\r\n", "\r"], "\n", $text);
$text = preg_replace("/[ \t]+/", " ", $text);
$text = preg_replace("/ +\n/", "\n", $text);
$text = preg_replace('/[\x00-\x1F\x7F\xA0\xAD\x{200B}-\x{200D}\x{FEFF}]/u', '', $text);
return trim($text);
}
$output = normalizeOutput($result['run']['stdout'] ?? '');
$expected = normalizeOutput($materi->outputkode);
$isCorrect = $output === $expected;
return response()->json([
'status' => $isCorrect ? 'correct' : 'incorrect',
'output' => $output,
'expected' => $expected,
]);
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ProfileController extends Controller
{
public function index()
{
return view('backend.users-profile');
}
public function update(Request $request)
{
$validatedData = $request->validate([
'nama_lengkap' => 'required',
'nim' => 'required',
'semester' => 'required',
'angkatan' => 'required',
'profile_image' => 'image|mimes:jpeg,png,jpg,gif|max:2048',
]);
$user = User::findOrFail(auth()->user()->id); // <-- Pindahkan ke atas
if ($request->hasFile('profile_image')) {
$image = $request->file('profile_image');
$imagePath = $image->store('images', 'public');
$user->foto = $imagePath;
}
$user->nama_lengkap = $request->input('nama_lengkap');
$user->nim = $request->input('nim');
$user->semester = $request->input('semester');
$user->angkatan = $request->input('angkatan');
$user->save();
return redirect('/profile')->with('success', 'Profile updated successfully');
}
public function changePassword(Request $request)
{
$request->validate([
'current_password' => 'required',
'new_password' => 'required|string|min:8|confirmed',
], [
'new_password.min' => 'Password tidak boleh kurang dari 8 karakter',
]);
$user = Auth::user();
// Verify the current password using the fully qualified namespace
if (!\Illuminate\Support\Facades\Hash::check($request->input('current_password'), $user->password)) {
return redirect()->back()->with('error', 'Current password is incorrect');
}
// Update the password
$user->password = \Illuminate\Support\Facades\Hash::make($request->input('new_password'));
$user->save();
return redirect()->back()->with('success', 'Password changed successfully');
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use App\Models\Kuesioner;
use App\Models\Periode;
use App\Models\PilihPeriode;
use Illuminate\Http\Request;
class QuestionnaireController extends Controller
{
public function index()
{
$idUser = auth()->user()->id;
$checkPeriod = PilihPeriode::first();
$checkKuesioner = Hasil::where('id_user', $idUser)->where('id_periode', $checkPeriod->id_periode)->count();
if ($checkKuesioner > 0) {
return redirect()->route('user.questionnaire.check');
}
$kuesioners = Kuesioner::get();
return view('backend.users_questionnaire', compact('kuesioners'));
}
public function store(Request $request)
{
$idUser = auth()->user()->id;
$checkPeriod = PilihPeriode::first();
$periode = Hasil::where('id_user', $idUser)->where('id_periode', $checkPeriod->id_periode)->count();
if ($periode > 0) {
return redirect()->route('user.questionnaire.check')->with('error', 'Gagal, anda sudah pernah mengisikan kuesioner');
}
$answer = []; // Array yang berisi data jawaban
foreach ($request->id as $index => $id) {
$value = $request->input('optionsGroup' . $id);
$kategori = $request->input('kategori')[$index];
// Membuat array asosiatif dengan kategori
$answerItem = [
'id' => $id,
'answer' => $value,
'kategori' => $kategori,
];
// Menambahkan array asosiatif ke dalam array $answer
$answer[] = $answerItem;
}
// Menginisialisasi array untuk menyimpan total jawaban per kategori
$totalsPerGroup = array_fill(1, 8, 0);
// Menghitung total jawaban untuk setiap kategori
foreach ($answer as $item) {
$kategori = $item['kategori'];
$totalsPerGroup[$kategori] += $item['answer'];
}
$kmTotal = $totalsPerGroup[1] + $totalsPerGroup[2] + $totalsPerGroup[3];
$kmClass = null;
if ($kmTotal >= 63) {
$kmClass = 'High';
} else if ($kmTotal >= 42) {
$kmClass = 'Medium';
} else {
$kmClass = 'Low';
}
$rmTotal = $totalsPerGroup[4] + $totalsPerGroup[5] + $totalsPerGroup[6] + $totalsPerGroup[7] + $totalsPerGroup[8];
$rmClass = null;
if ($rmTotal >= 132) {
$rmClass = 'High';
} else if ($rmTotal >= 88) {
$rmClass = 'Medium';
} else {
$rmClass = 'Low';
}
Hasil::create([
'id_user' => $idUser,
'id_periode' => $checkPeriod->id_periode,
'declarative_knowledge' => $totalsPerGroup[1],
'procedural_knowledge' => $totalsPerGroup[2],
'conditional_knowledge' => $totalsPerGroup[3],
'km_total' => $kmTotal,
'km_class' => $kmClass,
'planning' => $totalsPerGroup[4],
'information_management' => $totalsPerGroup[5],
'monitoring' => $totalsPerGroup[6],
'debugging' => $totalsPerGroup[7],
'evaluation' => $totalsPerGroup[8],
'rm_total' => $rmTotal,
'rm_class' => $rmClass,
]);
return redirect()->route('user.questionnaire.check');
}
// public function check()
// {
// $idUser = auth()->user()->id;
// $historiPengisian = Hasil::where('id_user', $idUser)->get();
// return view('backend.dashboard', compact('historiPengisian'));
// }
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class ResumeController extends Controller
{
public function index()
{
$userId = Auth::id();
$rangkumanList = DB::table('hasil')
->where('id_user', $userId)
->pluck('rangkuman')
->filter(function ($item) {
return !is_null($item) && trim($item) !== '';
});
return view('backend.resumepembelajaran', compact('rangkumanList'));
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers\backend;
use App\Http\Controllers\Controller;
use App\Models\Hasil;
use App\Models\PilihPeriode;
use Illuminate\Http\Request;
class UiController extends Controller
{
public function instruction()
{
return view('backend.questionnaire_instructions');
}
public function checkQuestionnaire()
{
$checkPeriod = PilihPeriode::first();
if ($checkPeriod->aktif == 0 || !$checkPeriod->id_periode) {
return view('backend.closed_questionnaire');
}
$idUser = auth()->user()->id;
$countResult = Hasil::where('id_user', $idUser)->where('id_periode', $checkPeriod->id_periode)->count();
if ($countResult > 0) {
return view('backend.completed_questionnaire');
}
return view('backend.not_filled_questionnaire');
}
public function closedQuestionnaire()
{
return view('backend.closed_questionnaire');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class HomeController extends Controller
{
//
public function index(){
return view('frontend.home');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}

69
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,69 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'class' => \App\Http\Middleware\CheckUserClass::class,
'check.questionnaire' => \App\Http\Middleware\CheckQuestionnaire::class,
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class CheckQuestionnaire
{
public function handle(Request $request, Closure $next)
{
$userId = Auth::id();
if (!$userId) {
// Jika belum login, redirect ke login
return redirect()->route('login');
}
// Ambil hasil VARK user
$hasil = DB::table('hasil')->where('id_user', $userId)->first();
// Jika data hasil tidak ada, atau semua nilai VARK kosong/0
if (
!$hasil ||
(
($hasil->visual ?? 0) == 0 &&
($hasil->auditory ?? 0) == 0 &&
($hasil->readwrite ?? 0) == 0 &&
($hasil->kinesthetic ?? 0) == 0
)
) {
// Redirect ke halaman cek kuesioner
// return redirect()->route('user.questionnaire.check')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
return redirect()->route('materi.index')->with('error', 'Silakan isi kuesioner terlebih dahulu.');
}
return $next($request);
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class CheckUserClass
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle($request, Closure $next, ...$classes)
{
$user = Auth::user();
if (!$user) {
// Jika pengguna belum masuk, arahkan ke halaman login (atau halaman yang sesuai).
return redirect('/login');
}
// Periksa kelas pengguna dengan kelas yang diberikan dalam parameter middleware.
foreach ($classes as $class) {
if ($user->kelas_user == $class) {
// Jika kelas pengguna cocok dengan kelas yang diberikan, lanjutkan ke permintaan berikutnya.
return $next($request);
}
}
// Jika kelas pengguna tidak cocok dengan kelas yang diberikan, arahkan ke halaman yang sesuai.
if (in_array($user->kelas_user, [1, 2])) {
return redirect('/admin');
} elseif ($user->kelas_user == 3) {
return redirect('/dashboard');
}
// Kelas pengguna tidak cocok dengan kelas yang diberikan dan bukan 1, 2, atau 3,
// sehingga arahkan ke halaman login (atau halaman yang sesuai).
return redirect('/login');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
'/logout',
];
}

48
app/Models/Hasil.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Hasil extends Model
{
use HasFactory;
protected $table = 'hasil';
protected $fillable = [
'id_user',
'id_periode',
'declarative_knowledge',
'procedural_knowledge',
'conditional_knowledge',
'km_total',
'km_class',
'planning',
'information_management',
'monitoring',
'debugging',
'evaluation',
'rm_total',
'rm_class',
'visual',
'auditory',
'readwrite',
'kinesthetic',
'id_style',
'id_lstyle',
'rangkuman',
'result',
'created_at',
'updated_at'
];
public function user()
{
return $this->belongsTo(User::class, 'id_user');
}
public function periode()
{
return $this->belongsTo(Periode::class, 'id_periode');
}
}

18
app/Models/Instruksi.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Instruksi extends Model
{
use HasFactory;
protected $table = 'instruksi';
protected $primaryKey = 'id_instruksi ';
protected $guarded = [
'id_lstyle',
'lv_meta',
'instruksi',
];
}

16
app/Models/Kuesioner.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Kuesioner extends Model
{
use HasFactory;
protected $table = 'kuesioner';
protected $fillable = [
'soal',
'kategori_soal',
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class KuesionerLearningStyle extends Model
{
use HasFactory;
protected $table = 'kuesioner_learning_style';
protected $primaryKey = 'id_ls';
protected $fillable = [
'email',
'visual',
'auditory',
'readwrite',
'kinesthetic',
'id_lstyle',
'result',
];
public function user()
{
return $this->belongsTo(User::class, 'email', 'email');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class KuesionerMetakognitif extends Model
{
use HasFactory;
protected $table = 'kuesioner_metakognitif';
protected $primaryKey = 'category ';
protected $guarded = [
'lv_meta',
'km_class',
'rm_class',
];
}

29
app/Models/Materi.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Materi extends Model
{
protected $table = 'materi';
public $timestamps = false;
protected $fillable = [
'id_style',
'id_materi',
'konten',
'audio',
'teks',
'kodesoal',
'outputkode',
'rangkuman',
];
// HAPUS baris ini:
// protected $primaryKey = ['id_style', 'id_materi'];
public $incrementing = false;
// Jika kamu ingin menggunakan find(), override method getKey() secara manual (opsional lanjutan)
}

17
app/Models/Periode.php Normal file
View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Periode extends Model
{
use HasFactory;
protected $table = 'periode';
protected $fillable = [
'id',
'semester',
'tahun'
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PilihPeriode extends Model
{
use HasFactory;
protected $table = 'pilih_periode';
public $timestamps = false;
protected $fillable = [
'id_periode',
'aktif',
];
}

52
app/Models/User.php Normal file
View File

@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'nama_lengkap',
'nim',
'semester',
'angkatan',
'email',
'email_verified_at',
'password',
'foto',
'kelas_user',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/dashboard';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

53
artisan Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

64
composer.json Normal file
View File

@ -0,0 +1,64 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/socialite": "^5.21",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

8290
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

237
config/app.php Normal file
View File

@ -0,0 +1,237 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'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
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
// Barryvdh\DomPDF\ServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'Date' => Illuminate\Support\Facades\Date::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Js' => Illuminate\Support\Js::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
// 'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
// 'PDF' => Barryvdh\DomPDF\Facade::class,
],
];

111
config/auth.php Normal file
View File

@ -0,0 +1,111 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire 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.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

64
config/broadcasting.php Normal file
View File

@ -0,0 +1,64 @@
<?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: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', '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' => [
'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'),
'useTLS' => true,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

110
config/cache.php Normal file
View File

@ -0,0 +1,110 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'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' => '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 a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

34
config/cors.php Normal file
View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

147
config/database.php Normal file
View File

@ -0,0 +1,147 @@
<?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 all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'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('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| 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 in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| 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 APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'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'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

73
config/filesystems.php Normal file
View File

@ -0,0 +1,73 @@
<?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. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'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),
],
],
/*
|--------------------------------------------------------------------------
| 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'),
],
];

52
config/hashing.php Normal file
View File

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
],
];

118
config/logging.php Normal file
View File

@ -0,0 +1,118 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'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' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| 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 to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'mail.hypermedialearning.com'),
'port' => env('MAIL_PORT', 465),
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails 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 e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'admin@hypermedialearning.com'),
'name' => env('MAIL_FROM_NAME', 'Admin Hypermedialearning'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

93
config/queue.php Normal file
View File

@ -0,0 +1,93 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'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' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

65
config/sanctum.php Normal file
View File

@ -0,0 +1,65 @@
<?php
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',
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
))),
/*
|--------------------------------------------------------------------------
| 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. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| 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' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];

48
config/services.php Normal file
View File

@ -0,0 +1,48 @@
<?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.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'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'),
],
'jdoodle' => [
'client_id' => env('JDOODLE_CLIENT_ID'),
'client_secret' => env('JDOODLE_CLIENT_SECRET'),
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_REDIRECT_URI'),
'guzzle' => [
'verify' => false, // Hanya untuk pengembangan
],
],
];

201
config/session.php Normal file
View File

@ -0,0 +1,201 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| 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 immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'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', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| 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 cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'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 are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| 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. You are free to modify this option if needed.
|
*/
'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" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

36
config/view.php Normal file
View File

@ -0,0 +1,36 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,39 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('nama_lengkap');
$table->string('nim');
$table->integer('semester');
$table->integer('angkatan');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('foto')->nullable();
$table->enum('kelas_user',['1','2','3']);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHasil extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hasil', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('id_user');
$table->integer('id_periode');
$table->integer('declarative_knowledge');
$table->integer('procedural_knowledge');
$table->integer('conditional_knowledge');
$table->integer('km_total');
$table->string('km_class');
$table->integer('planning');
$table->integer('information_management');
$table->integer('monitoring');
$table->integer('debugging');
$table->integer('evaluation');
$table->integer('rm_total');
$table->string('rm_class');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hasil');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateKuesioner extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('kuesioner', function (Blueprint $table) {
$table->id();
$table->string('soal');
$table->enum('kategori_soal',['1','2','3','4','5','6','7','8']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('kuesioner');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAgent extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('agent', function (Blueprint $table) {
$table->id();
$table->string('text');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('agent');
}
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdmin extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('admin', function (Blueprint $table) {
$table->id();
$table->string('nama_lengkap')->unique();
$table->string('nip')->nullable;
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->enum('kelas_user',['1','2','3']);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('admin');
}
}

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePeriode extends Migration
{
public function up()
{
Schema::create('periode', function (Blueprint $table) {
$table->id(); // Kolom ID dengan tipe data INT dan Auto Increment
$table->enum('semester', ['1', '2'])->notNullable(); // Kolom ENUM untuk semester (1 atau 2)
$table->char('tahun', 9)->notNullable(); // Kolom CHAR untuk tahun (misalnya, "2021/2023")
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('periode');
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIdPeriodeToHasil extends Migration
{
public function up()
{
Schema::table('hasil', function (Blueprint $table) {
$table->foreign('id_periode')->references('id')->on('periode');
$table->foreign(['id_periode'], 'produk_ibfk_2')
->references(['id'])
->on('periode')
->onUpdate('CASCADE')
->onDelete('CASCADE');
});
}
public function down()
{
// Schema::table('hasil', function (Blueprint $table) {
// $table->dropForeign(['id_periode']); // Menghapus foreign key
// $table->dropColumn('id_periode'); // Menghapus kolom foreign key
// });
}
}

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePilihPeriodeTable extends Migration
{
public function up()
{
Schema::create('pilih_periode', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('id_periode');
$table->enum('aktif', ['0', '1']);
// Menambahkan foreign key constraint ke tabel periode
$table->foreign('id_periode')->references('id')->on('periode');
});
}
public function down()
{
Schema::dropIfExists('pilih_periode');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up()
{
Schema::table('materi', function (Blueprint $table) {
// Tambah primary key gabungan jika belum ada
$table->dropPrimary(); // Buang primary key lama jika ada
$table->primary(['id_style', 'id_materi']);
// Tambah foreign key ke tabel hasil
$table->foreign('id_style')
->references('id_style')
->on('hasil')
->onDelete('cascade');
});
}
public function down()
{
Schema::table('materi', function (Blueprint $table) {
$table->dropForeign(['id_style']);
$table->dropPrimary();
});
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIdMateriToInstruksiTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('instruksi', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('instruksi', function (Blueprint $table) {
//
});
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// \App\Models\User::factory(10)->create();
}
}

9200
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More