commit
2c9f1454bd
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
|
@ -0,0 +1,60 @@
|
|||
APP_NAME="Naive Bayes Data Mining"
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
# Jangan gunakan SQLite!
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,11 @@
|
|||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
|
@ -0,0 +1,22 @@
|
|||
/.phpunit.cache
|
||||
/database/database.sqlite
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
composer.lock
|
||||
package-lock.json
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
|
@ -0,0 +1,100 @@
|
|||
# Deskripsi
|
||||
|
||||
> [!WARNING]
|
||||
> Karena kolom pada tabel dataset menggunakan foreign key dinamis, mohon untuk tidak menggunakan SQLite.
|
||||
|
||||
<p>Aplikasi ini adalah aplikasi Klasifikasi Kelayakan Calon Penerima Bantuan Sosial menggunakan algoritma Naive Bayes. Komponen yang digunakan:</p>
|
||||
|
||||
- [Laravel 10](https://laravel.com/)
|
||||
- [Livewire 3](https://livewire.laravel.com/)
|
||||
- [PHP 8.2.18](https://www.php.net/)
|
||||
- [Volt Bootstrap 5 Dashboard](https://github.com/themesberg/volt-bootstrap-5-dashboard)
|
||||
- [FontAwesome](https://fontawesome.com)
|
||||
- [ApexCharts](https://apexcharts.com/)
|
||||
- [DataTables](https://datatables.net/)
|
||||
- [Notiflix](https://notiflix.github.io)
|
||||
- [Logo oleh Uniconlabs](https://www.freepik.com/icon/data-mining_8438890)
|
||||
|
||||
## Cara Menggunakan
|
||||
|
||||
1. Download atau clone aplikasi ini.
|
||||
2. Buka folder pada aplikasi yang sudah didownload atau di-clone.
|
||||
3. Buka Command Prompt/Terminal/PowerShell, lalu masukkan perintah `composer install`.
|
||||
4. Ganti nama `.env.example` menjadi `.env`, lalu atur nama Database pada file .env.
|
||||
5. Masukkan perintah `php artisan key:generate`
|
||||
6. Masukkan perintah `php artisan migrate --seed`.
|
||||
7. Masukkan perintah `php artisan serve`, lalu buka <http://localhost:8000/>
|
||||
|
||||
### Kredensial
|
||||
|
||||
Email: <test@example.com><br>
|
||||
Password: password
|
||||
|
||||
---
|
||||
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[WebReinvent](https://webreinvent.com/)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Jump24](https://jump24.co.uk)**
|
||||
- **[Redberry](https://redberry.international/laravel/)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
- **[byte5](https://byte5.de)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@ -0,0 +1,27 @@
|
|||
<?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.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Classification;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
|
||||
class ClassificationExport
|
||||
implements FromQuery, WithHeadings, WithMapping, WithStrictNullComparison
|
||||
{
|
||||
use Exportable;
|
||||
private string $tipe;
|
||||
private int $index = 0;
|
||||
public function __construct(string $type)
|
||||
{
|
||||
$this->tipe = $type;
|
||||
}
|
||||
public function headings(): array
|
||||
{
|
||||
return array(
|
||||
'#',
|
||||
'Nama',
|
||||
ProbabLabel::$label[true],
|
||||
ProbabLabel::$label[false],
|
||||
'Kelas Prediksi',
|
||||
'Kelas Asli'
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
if ($this->tipe === 'train' || $this->tipe === 'test')
|
||||
return Classification::query()->where('type', $this->tipe);
|
||||
return Classification::query();
|
||||
}
|
||||
public function map($class): array
|
||||
{
|
||||
global $index;
|
||||
return array(
|
||||
++$index,
|
||||
$class->name,
|
||||
$class->true ?? 0.00,
|
||||
$class->false ?? 0.00,
|
||||
ProbabLabel::$label[$class->predicted],
|
||||
ProbabLabel::$label[$class->real]
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use Generator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromGenerator;
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
|
||||
class DatasetTemplate implements FromGenerator, WithStrictNullComparison
|
||||
{
|
||||
use Exportable;
|
||||
public function generator(): Generator
|
||||
{
|
||||
$col[] = 'Nama';
|
||||
$val['nama'] = Auth::user()->name;
|
||||
foreach (Atribut::get() as $attr) {
|
||||
$subval = [];
|
||||
$col[] = $attr->name;
|
||||
if ($attr->type === 'categorical') {
|
||||
foreach (NilaiAtribut::where('atribut_id', $attr->id)->get() as $sub) {
|
||||
$subval[] = $sub->name;
|
||||
}
|
||||
$val[$attr->slug] = $subval;
|
||||
} else $val[$attr->slug] = rand(0, 1);
|
||||
}
|
||||
$col[] = 'Hasil';
|
||||
$val['hasil'] = ProbabLabel::$label;
|
||||
yield $col;
|
||||
yield $val;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\TestingData;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
|
||||
class TestingExport
|
||||
implements FromCollection, WithHeadings, WithMapping, WithStrictNullComparison
|
||||
{
|
||||
public function headings(): array
|
||||
{
|
||||
$col[] = '#';
|
||||
$col[] = "Nama";
|
||||
foreach (Atribut::get() as $value) $col[] = $value->name;
|
||||
$col[] = "Hasil";
|
||||
return $col;
|
||||
}
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return TestingData::all();
|
||||
}
|
||||
public function map($test): array
|
||||
{
|
||||
$row[] = $test->id;
|
||||
$row[] = $test->nama;
|
||||
foreach (Atribut::get() as $val) {
|
||||
if ($val->type === 'categorical') {
|
||||
$foreign = NilaiAtribut::firstWhere('id', $test[$val->slug]);
|
||||
$row[] = $foreign->name;
|
||||
} else $row[] = $test[$val->slug];
|
||||
}
|
||||
$row[] = ProbabLabel::$label[$test->status];
|
||||
return $row;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\TrainingData;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
|
||||
class TrainingExport
|
||||
implements FromCollection, WithHeadings, WithMapping, WithStrictNullComparison
|
||||
{
|
||||
public function headings(): array
|
||||
{
|
||||
$col[] = '#';
|
||||
$col[] = "Nama";
|
||||
foreach (Atribut::get() as $value) $col[] = $value->name;
|
||||
$col[] = "Hasil";
|
||||
return $col;
|
||||
}
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return TrainingData::all();
|
||||
}
|
||||
public function map($train): array
|
||||
{
|
||||
$row[] = $train->id;
|
||||
$row[] = $train->nama;
|
||||
foreach (Atribut::get() as $val) {
|
||||
if ($val->type === 'categorical') {
|
||||
$foreign = NilaiAtribut::firstWhere('id', $train[$val->slug]);
|
||||
$row[] = $foreign->name;
|
||||
} else $row[] = $train[$val->slug];
|
||||
}
|
||||
$row[] = ProbabLabel::$label[$train->status];
|
||||
return $row;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\TestingData;
|
||||
use App\Models\TrainingData;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'test' => TestingData::count(),
|
||||
'train' => TrainingData::count(),
|
||||
'total' => TestingData::count() + TrainingData::count()
|
||||
];
|
||||
return view('main.index', $data);
|
||||
}
|
||||
public function logout()
|
||||
{
|
||||
User::find(Auth::id())->update(['remember_token' => null]);
|
||||
Auth::logout();
|
||||
Session::invalidate();
|
||||
Session::regenerateToken();
|
||||
Session::flash('success', 'Anda sudah logout');
|
||||
return to_route('login');
|
||||
}
|
||||
public function edit()
|
||||
{
|
||||
return view('main.profil');
|
||||
}
|
||||
public function update(Request $request)
|
||||
{
|
||||
$id = auth()->user()->id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error', 'terdapat data yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$findUser = User::find($id);
|
||||
|
||||
if($findUser) {
|
||||
// update data
|
||||
$findUser->name = $input['name'];
|
||||
$findUser->email = $input['email'];
|
||||
if(!empty($input['password'])) {
|
||||
$findUser->password = bcrypt($input['password']);
|
||||
}
|
||||
|
||||
// save data
|
||||
$findUser->save();
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Tidak ditemukan data!');
|
||||
}
|
||||
}
|
||||
public function delete(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->validate(User::$delrules);
|
||||
User::findOrFail(Auth::id())->delete();
|
||||
Auth::logout();
|
||||
Session::invalidate();
|
||||
Session::regenerateToken();
|
||||
Session::flash('success', "Akun sudah dihapus");
|
||||
return response()->json(['message' => 'Akun sudah dihapus']);
|
||||
} catch (ModelNotFoundException) {
|
||||
return response()->json(['message' => 'Akun tidak ditemukan'], 404);
|
||||
} catch (QueryException $db) {
|
||||
Log::error($db);
|
||||
return response()->json(['message' => $db->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class AtributController extends Controller
|
||||
{
|
||||
public function count()
|
||||
{
|
||||
$attr = Atribut::count();
|
||||
$unused = 0;
|
||||
foreach (Atribut::where('type', 'categorical')->get() as $at) {
|
||||
if (NilaiAtribut::where('atribut_id', $at->id)->count() === 0)
|
||||
$unused++;
|
||||
}
|
||||
return ['total' => $attr, 'unused' => $unused];
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('main.atribut.index');
|
||||
}
|
||||
public function user_index()
|
||||
{
|
||||
return view('main.atribut.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return DataTables::of(Atribut::query())
|
||||
->editColumn('type', function (Atribut $attr) {
|
||||
return Atribut::$tipe[$attr->type];
|
||||
})->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->validate(Atribut::$rules);
|
||||
$req = $request->all();
|
||||
$req['slug'] = Str::slug($request->name, '_');
|
||||
if (!empty($request->id)) {
|
||||
$atribut = Atribut::findOrFail($request->id);
|
||||
$this->editColumn('training_data', $atribut, $req);
|
||||
$this->editColumn('testing_data', $atribut, $req);
|
||||
$atribut->update([
|
||||
'name' => $req['name'],
|
||||
'slug' => $req['slug'],
|
||||
'type' => $req['type'],
|
||||
'desc' => $req['desc']
|
||||
]);
|
||||
return response()->json(['message' => 'Berhasil diedit']);
|
||||
} else {
|
||||
$this->addColumn('training_data', $req);
|
||||
$this->addColumn('testing_data', $req);
|
||||
Atribut::create($req);
|
||||
return response()->json(['message' => 'Berhasil disimpan']);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
if (in_array($e->errorInfo[1], [1060,1062])) {
|
||||
$err = "Nama Atribut sudah digunakan";
|
||||
if (!empty($request->id))
|
||||
$err .= '. Gunakan nama yang lain jika Anda ingin mengganti tipe atribut.';
|
||||
return response()->json([
|
||||
'message' => "Nama Atribut \"$request->name\" sudah digunakan",
|
||||
'errors' => ['name' => $err]
|
||||
], 422);
|
||||
}
|
||||
Log::error($e);
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Atribut $atribut)
|
||||
{
|
||||
return response()->json($atribut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Atribut $atribut)
|
||||
{
|
||||
$this->delColumn('training_data', $atribut);
|
||||
$this->delColumn('testing_data', $atribut);
|
||||
$atribut->delete();
|
||||
return response()->json(['message' => "Berhasil dihapus"]);
|
||||
}
|
||||
private function addColumn(string $tabel, array $req): void
|
||||
{
|
||||
if (!Schema::hasColumn($tabel, $req['slug'])) {
|
||||
Schema::table($tabel, function (Blueprint $table) use ($req) {
|
||||
if ($req['type'] === 'numeric')
|
||||
$table->integer($req['slug'])->nullable()->after('nama');
|
||||
else {
|
||||
$table->foreignId($req['slug'])->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate()->after('nama');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private function editColumn(string $tabel, $attr, array $req): void
|
||||
{
|
||||
Schema::table($tabel, function (Blueprint $table) use ($attr, $req) {
|
||||
if ($attr->type !== $req['type']) {
|
||||
if ($req['type'] === 'numeric') {
|
||||
$table->dropConstrainedForeignId($attr->slug);
|
||||
$table->integer($req['slug'])->nullable()->after('nama');
|
||||
} else {
|
||||
$table->dropColumn($attr->slug);
|
||||
$table->foreignId($req['slug'])->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate()->after('nama');
|
||||
}
|
||||
} else if ($attr->name !== $req['name']) {
|
||||
if ($attr->type === 'categorical') $table->dropForeign([$attr->slug]);
|
||||
$table->renameColumn($attr->slug, $req['slug']);
|
||||
if ($req['type'] === 'categorical') {
|
||||
$table->foreign($req['slug'])->references('id')->on('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private function delColumn(string $tabel, $attr): void
|
||||
{
|
||||
if (Schema::hasColumn($tabel, $attr->slug)) {
|
||||
Schema::table($tabel, function (Blueprint $table) use ($attr) {
|
||||
if ($attr->type === 'categorical') $table->dropForeign([$attr->slug]);
|
||||
$table->dropColumn($attr->slug);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Exports\ClassificationExport;
|
||||
use App\Models\Classification;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TestingData;
|
||||
use App\Models\TrainingData;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class ClassificationController extends Controller
|
||||
{
|
||||
public function export($type)
|
||||
{
|
||||
if (Classification::count() === 0)
|
||||
return back()->withError('Gagal download: Tidak ada data hasil klasifikasi');
|
||||
return Excel::download(
|
||||
new ClassificationExport($type),
|
||||
"klasifikasi_{$type}.xlsx"
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('main.naivebayes.classify', ['hasil' => ProbabLabel::$label]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
$request->validate(Classification::$rule);
|
||||
try {
|
||||
if (Probability::count() === 0)
|
||||
return response()->json(['message' => 'Probabilitas belum dihitung'], 400);
|
||||
|
||||
//Preprocessor Start
|
||||
if ($request->tipe === 'test') $pre = ProbabLabel::preprocess('test');
|
||||
//Preprocessor End
|
||||
|
||||
$semuadata = $this->getData($request->tipe); //Dataset
|
||||
if (!$semuadata) {
|
||||
return response()->json([
|
||||
'message' => 'Tipe Data yang dipilih kosong',
|
||||
'errors' => ['tipe' => 'Tipe Data yang dipilih kosong']
|
||||
], 400);
|
||||
}
|
||||
foreach ($semuadata as $dataset) {
|
||||
$klasifikasi = ProbabLabel::hitungProbab($dataset);
|
||||
Classification::updateOrCreate([
|
||||
'name' => $dataset->nama, 'type' => $request->tipe
|
||||
], [
|
||||
'true' => $klasifikasi['true'],
|
||||
'false' => $klasifikasi['false'],
|
||||
'predicted' => $klasifikasi['predict'],
|
||||
'real' => $dataset->status
|
||||
]);
|
||||
}
|
||||
return response()->json([
|
||||
'message' => 'Berhasil dihitung', 'preprocess' => $pre??0
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return DataTables::of(Classification::query())
|
||||
->editColumn('type', function (Classification $class) {
|
||||
return Classification::$tipedata[$class->type];
|
||||
})->editColumn('predicted', function (Classification $class) {
|
||||
return ProbabLabel::$label[$class->predicted];
|
||||
})->editColumn('real', function (Classification $class) {
|
||||
return ProbabLabel::$label[$class->real];
|
||||
})->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
$request->validate(Classification::$rule);
|
||||
try {
|
||||
if ($request->tipe === 'all') Classification::truncate();
|
||||
else Classification::where('type', $request->tipe)->delete();
|
||||
return response()->json(['message' => 'Berhasil direset']);
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
private function getData(string $type)
|
||||
{
|
||||
if ($type === 'train') {
|
||||
if (TrainingData::count() === 0) return false;
|
||||
$data = TrainingData::get();
|
||||
} else {
|
||||
if (TestingData::count() === 0) return false;
|
||||
$data = TestingData::get();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TestingData;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\TrainingData;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exports\TestingExport;
|
||||
use App\Imports\TestingImport;
|
||||
use App\Models\Classification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$atribut = Atribut::all();
|
||||
return view('user.index', compact('atribut'));
|
||||
}
|
||||
public function user_testing()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Tambahkan Atribut dulu sebelum menginput Dataset');
|
||||
}
|
||||
$nilai = NilaiAtribut::get();
|
||||
$calculated = Probability::count();
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view(
|
||||
'user.dataset.testing',
|
||||
compact('atribut', 'nilai', 'calculated', 'hasil')
|
||||
);
|
||||
}
|
||||
public function user_training()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Tambahkan Atribut dulu sebelum menginput Dataset');
|
||||
}
|
||||
$nilai = NilaiAtribut::get();
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view('user.dataset.training', compact('atribut', 'nilai', 'hasil'));
|
||||
}
|
||||
|
||||
public function user_probab()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Atribut dan Nilai Atribut Kosong');
|
||||
}
|
||||
$nilaiattr = NilaiAtribut::get();
|
||||
$data = Probability::get();
|
||||
$kelas = Probability::probabKelas();
|
||||
$training = TrainingData::get();
|
||||
$attribs = ['atribut' => $atribut, 'nilai' => $nilaiattr];
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view(
|
||||
'user.naivebayes.probab',
|
||||
compact('attribs', 'data', 'kelas', 'training', 'hasil')
|
||||
);
|
||||
}
|
||||
public function user_class()
|
||||
{
|
||||
return view('user.naivebayes.classify', ['hasil' => ProbabLabel::$label]);
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return view('user.profil');
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$id = auth()->user()->id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error', 'terdapat data yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$findUser = User::find($id);
|
||||
|
||||
if($findUser) {
|
||||
// update data
|
||||
$findUser->name = $input['name'];
|
||||
$findUser->email = $input['email'];
|
||||
if(!empty($input['password'])) {
|
||||
$findUser->password = bcrypt($input['password']);
|
||||
}
|
||||
|
||||
// save data
|
||||
$findUser->save();
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Tidak ditemukan data!');
|
||||
}
|
||||
}
|
||||
|
||||
public function performa()
|
||||
{
|
||||
if (Classification::count() === 0) {
|
||||
return to_route('class.index')
|
||||
->withWarning('Lakukan klasifikasi dulu sebelum melihat performa klasifikasi');
|
||||
}
|
||||
$data['train'] = $this->cm('train');
|
||||
$data['test'] = $this->cm('test');
|
||||
$performa['train'] = $this->performas($data['train']);
|
||||
$performa['test'] = $this->performas($data['test']);
|
||||
$stat = ProbabLabel::$label;
|
||||
return view('user.performa', compact('data', 'performa', 'stat'));
|
||||
}
|
||||
|
||||
private static function cm(string $type)
|
||||
{
|
||||
$tp = Classification::where('type', $type)->where('predicted', true)
|
||||
->where('real', true)->count(); //True Positive
|
||||
$fp = Classification::where('type', $type)->where('predicted', true)
|
||||
->where('real', false)->count(); //False Positive
|
||||
$fn = Classification::where('type', $type)->where('predicted', false)
|
||||
->where('real', true)->count(); //False Negative
|
||||
$tn = Classification::where('type', $type)->where('predicted', false)
|
||||
->where('real', false)->count(); //True Negative
|
||||
$total = $tp + $fp + $fn + $tn;
|
||||
return [
|
||||
'tp' => $tp,
|
||||
'fp' => $fp,
|
||||
'fn' => $fn,
|
||||
'tn' => $tn,
|
||||
'total' => $total
|
||||
];
|
||||
}
|
||||
private static function performas(array $data)
|
||||
{
|
||||
if ($data['total'] === 0) $accu = $prec = $rec = $f1 = 0;
|
||||
else {
|
||||
$accu = (($data['tp'] + $data['tn']) / $data['total']) * 100;
|
||||
$prec = ($data['tp'] / ($data['tp'] + $data['fp'])) * 100;
|
||||
$rec = ($data['tp'] / ($data['tp'] + $data['fn'])) * 100;
|
||||
$f1 = 2 * ($prec * $rec) / ($prec + $rec);
|
||||
}
|
||||
return [
|
||||
'accuracy' => $accu, 'precision' => $prec, 'recall' => $rec, 'f1' => $f1
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class NilaiAtributController extends Controller
|
||||
{
|
||||
public function count()
|
||||
{
|
||||
$attr = Atribut::get();
|
||||
$attribs = NilaiAtribut::get();
|
||||
$totalscr = [];
|
||||
$duplicate = 0;
|
||||
foreach ($attr as $at) {
|
||||
$subs = NilaiAtribut::where('atribut_id', $at->id)->get();
|
||||
$totalscr[] = count($subs);
|
||||
$subUnique = $subs->unique(['name']);
|
||||
$duplicate += $subs->diff($subUnique)->count();
|
||||
}
|
||||
return response()->json([
|
||||
'total' => count($attribs),
|
||||
'max' => collect($totalscr)->max() ?? 0,
|
||||
'duplicate' => $duplicate
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$atribut = Atribut::where('type', 'categorical')->get();
|
||||
if (Atribut::count() === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Tambahkan Atribut dulu sebelum menambah nilai atribut');
|
||||
}
|
||||
return view('main.atribut.nilai', compact('atribut'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return DataTables::of(
|
||||
NilaiAtribut::with('atribut')->select('nilai_atributs.*')
|
||||
)->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->validate(NilaiAtribut::$rules);
|
||||
if (!empty($request->id)) {
|
||||
NilaiAtribut::updateOrCreate(['id' => $request->id], [
|
||||
'name' => $request->name, 'atribut_id' => $request->atribut_id
|
||||
]);
|
||||
return response()->json(['message' => 'Berhasil diedit']);
|
||||
} else {
|
||||
NilaiAtribut::create([
|
||||
'name' => $request->name, 'atribut_id' => $request->atribut_id
|
||||
]);
|
||||
return response()->json(['message' => 'Berhasil disimpan']);
|
||||
}
|
||||
} catch (QueryException $th) {
|
||||
Log::error($th);
|
||||
return response()->json(['message' => $th->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(NilaiAtribut $nilai)
|
||||
{
|
||||
return response()->json($nilai);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(NilaiAtribut $nilai)
|
||||
{
|
||||
$nilai->delete();
|
||||
return response()->json(['message' => 'Berhasil dihapus']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Atribut;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TrainingData;
|
||||
use App\Models\TestingData;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProbabLabel extends Controller
|
||||
{
|
||||
public static array $label = [
|
||||
0 => 'Tidak Sesuai', //false: Mampu/Tidak Sesuai
|
||||
1 => 'Sesuai' //true : Tidak Mampu/Sesuai
|
||||
];
|
||||
public static function preprocess(string $type)
|
||||
{ //Impute missing values
|
||||
try {
|
||||
$novals = 0;
|
||||
if ($type === 'test') $data = new TestingData();
|
||||
else $data = new TrainingData();
|
||||
foreach (Atribut::get() as $attr) {
|
||||
$missing = $data->whereNull($attr->slug)->get();
|
||||
$novals += count($missing);
|
||||
if (count($missing) > 0) {
|
||||
if ($attr->type === 'numeric') //Jika Numerik, rata-rata yang dicari
|
||||
$avg = $data->avg($attr->slug);
|
||||
else { //Jika Kategorikal, paling sering muncul yang dicari
|
||||
$most = $data->select($attr->slug)->groupBy($attr->slug)
|
||||
->orderByRaw("COUNT(*) desc")->first();
|
||||
}
|
||||
$data->whereNull($attr->slug)
|
||||
->update([$attr->slug => $most[$attr->slug] ?? $avg]);
|
||||
}
|
||||
}
|
||||
return $novals;
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static function hitungProbab($data)
|
||||
{
|
||||
$semuadata = TrainingData::count();
|
||||
|
||||
/**==================================================
|
||||
* PRIOR
|
||||
* ==================================================
|
||||
* Jumlah Probabilitas berlabel Sesuai dan Tidak Sesuai
|
||||
*/ $prior = Probability::probabKelas();
|
||||
|
||||
/**=====================================================================
|
||||
* LIKELIHOOD & EVIDENCE
|
||||
* =====================================================================
|
||||
* Likelihood: Jumlah probabilitas dari label Sesuai dan Tidak Sesuai
|
||||
* Evidence: Jumlah probabilitas total
|
||||
*
|
||||
* Likelihood dan Evidence diinisialisasi dengan angka 1 untuk perkalian
|
||||
*/
|
||||
$likelihood['true'] = $likelihood['false'] = $evidence = 1;
|
||||
foreach (Atribut::get() as $at) {
|
||||
if ($at->type === 'categorical') {
|
||||
//Jika Kategorikal, nilai probabilitas yang dicari
|
||||
$probabilitas = Probability::firstWhere(
|
||||
'nilai_atribut_id',
|
||||
$data[$at->slug]
|
||||
);
|
||||
$probabs = [
|
||||
'true' => json_decode($probabilitas->true),
|
||||
'false' => json_decode($probabilitas->false)
|
||||
];
|
||||
$likelihood['true'] *= $probabs['true'];
|
||||
$likelihood['false'] *= $probabs['false'];
|
||||
$evidence *= TrainingData::where($at->slug, $data[$at->slug])->count() /
|
||||
$semuadata;
|
||||
} else { //Jika Numerik, Normal Distribution yang dicari
|
||||
$probabilitas = Probability::where('atribut_id', $at->id)
|
||||
->whereNull('nilai_atribut_id')->first();
|
||||
$trues = json_decode($probabilitas->true);
|
||||
$falses = json_decode($probabilitas->false);
|
||||
$total = json_decode($probabilitas->total);
|
||||
$likelihood['true'] *= self::normalDistribution(
|
||||
$data[$at->slug],
|
||||
$trues->sd,
|
||||
$trues->mean
|
||||
);
|
||||
$likelihood['false'] *= self::normalDistribution(
|
||||
$data[$at->slug],
|
||||
$falses->sd,
|
||||
$falses->mean
|
||||
);
|
||||
$evidence *= self::normalDistribution(
|
||||
$data[$at->slug],
|
||||
$total->sd,
|
||||
$total->mean
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**====================================================
|
||||
* POSTERIOR
|
||||
* ====================================================
|
||||
* Rumus: Prior dikali Likelihood, lalu dibagi Evidence
|
||||
* Jika Evidence 0, maka nilai posteriornya 0
|
||||
*/
|
||||
$posterior['true'] = ($prior['true'] * $likelihood['true']) / $evidence;
|
||||
$posterior['false'] = ($prior['false'] * $likelihood['false']) / $evidence;
|
||||
|
||||
$predict = $posterior['true'] >= $posterior['false'];
|
||||
return [
|
||||
'true' => $posterior['true'],
|
||||
'false' => $posterior['false'],
|
||||
'predict' => $predict
|
||||
];
|
||||
}
|
||||
private static function normalDistribution(int $x, float $sd, float $mean)
|
||||
{
|
||||
return (1 / ($sd * sqrt(2 * pi()))) * exp(-0.5 * pow(($x - $mean) / $sd, 2));
|
||||
}
|
||||
/**
|
||||
* This user-land implementation follows the implementation quite strictly;
|
||||
* it does not attempt to improve the code or algorithm in any way.
|
||||
*
|
||||
* @param array $a
|
||||
* @param bool $sample [optional] Defaults to false
|
||||
* @return float|bool The standard deviation or false on error.
|
||||
*/
|
||||
public static function stats_standard_deviation(array $a, bool $sample = false)
|
||||
{
|
||||
$n = count($a);
|
||||
if ($n === 0) return false;
|
||||
if ($sample && $n === 1) return false;
|
||||
$mean = array_sum($a) / $n;
|
||||
$carry = 0.0;
|
||||
foreach ($a as $val) $carry += pow(((float) $val) - $mean, 2);
|
||||
if ($sample) --$n;
|
||||
return sqrt($carry / $n);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Atribut;
|
||||
use App\Models\Classification;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TrainingData;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProbabilityController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Atribut dan Nilai Atribut Kosong');
|
||||
}
|
||||
$nilaiattr = NilaiAtribut::get();
|
||||
$data = Probability::get();
|
||||
$kelas = Probability::probabKelas();
|
||||
$training = TrainingData::get();
|
||||
$attribs = ['atribut' => $atribut, 'nilai' => $nilaiattr];
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view(
|
||||
'main.naivebayes.probab',
|
||||
compact('attribs', 'data', 'kelas', 'training', 'hasil')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
if (TrainingData::count() === 0) {
|
||||
return to_route("training.index")
|
||||
->withWarning('Masukkan Data Training dulu sebelum menghitung Probabilitas');
|
||||
}
|
||||
|
||||
//Preprocessor Start
|
||||
$pre = ProbabLabel::preprocess('train');
|
||||
//Preprocessor End
|
||||
|
||||
//Prior start
|
||||
$total = [
|
||||
'true' => TrainingData::where('status', 1)->count(),
|
||||
'false' => TrainingData::where('status', 0)->count(),
|
||||
'all' => TrainingData::count()
|
||||
];
|
||||
//Prior end
|
||||
|
||||
//Likelihood Start
|
||||
foreach (NilaiAtribut::get() as $nilai) { //Categorical
|
||||
if ($nilai->atribut->type === 'categorical') {
|
||||
$ll[$nilai->atribut_id.$nilai->name]['true'] = ($total['true'] === 0 ? 0 :
|
||||
TrainingData::where($nilai->atribut->slug, $nilai->id)
|
||||
->where('status', 1)->count() / $total['true']);
|
||||
$ll[$nilai->atribut_id.$nilai->name]['false'] = ($total['false'] === 0 ? 0 :
|
||||
TrainingData::where($nilai->atribut->slug, $nilai->id)
|
||||
->where('status', 0)->count() / $total['false']);
|
||||
$ll[$nilai->atribut_id.$nilai->name]['total'] =
|
||||
TrainingData::where($nilai->atribut->slug, $nilai->id)->count() /
|
||||
$total['all'];
|
||||
}
|
||||
Probability::updateOrCreate([
|
||||
'atribut_id' => $nilai->atribut_id, 'nilai_atribut_id' => $nilai->id
|
||||
], [
|
||||
'true' => json_encode($ll[$nilai->atribut_id.$nilai->name]['true']),
|
||||
'false' => json_encode($ll[$nilai->atribut_id.$nilai->name]['false']),
|
||||
'total' => json_encode($ll[$nilai->atribut_id.$nilai->name]['total'])
|
||||
]);
|
||||
}
|
||||
foreach (Atribut::where('type', 'numeric')->get() as $nilainum) { //Numeric
|
||||
$p = array_filter($this->getNumbers($nilainum->slug));
|
||||
if (count($p['true'])) {
|
||||
$avg[$nilainum->name]['true'] = array_sum($p['true']) / count($p['true']);
|
||||
$sd[$nilainum->name]['true'] =
|
||||
ProbabLabel::stats_standard_deviation($p['true'], true);
|
||||
}
|
||||
if (count($p['false'])) {
|
||||
$avg[$nilainum->name]['false'] =
|
||||
array_sum($p['false']) / count($p['false']);
|
||||
$sd[$nilainum->name]['false'] =
|
||||
ProbabLabel::stats_standard_deviation($p['false'], true);
|
||||
}
|
||||
$avg[$nilainum->name]['all'] = array_sum($p['all']) / count($p['all']);
|
||||
$sd[$nilainum->name]['all'] =
|
||||
ProbabLabel::stats_standard_deviation($p['all'], true);
|
||||
Probability::updateOrCreate([
|
||||
'atribut_id' => $nilainum->id, 'nilai_atribut_id' => null
|
||||
], [
|
||||
'true' => json_encode([
|
||||
'mean' => $avg[$nilainum->name]['true'],
|
||||
'sd' => $sd[$nilainum->name]['true']
|
||||
]),
|
||||
'false' => json_encode([
|
||||
'mean' => $avg[$nilainum->name]['false'],
|
||||
'sd' => $sd[$nilainum->name]['false']
|
||||
]),
|
||||
'total' => json_encode([
|
||||
'mean' => $avg[$nilainum->name]['all'],
|
||||
'sd' => $sd[$nilainum->name]['all']
|
||||
])
|
||||
]);
|
||||
}
|
||||
//Likelihood End
|
||||
|
||||
if ($pre === false) {
|
||||
return back()->withWarning(
|
||||
'Probabilitas berhasil dihitung, tetapi terjadi kesalahan pada preprocessing.'
|
||||
);
|
||||
}else{
|
||||
if($pre>0)
|
||||
$msg="Probabilitas berhasil dihitung. Preprocessing sudah dilakukan.";
|
||||
else $msg="Probabilitas berhasil dihitung";
|
||||
}
|
||||
return back()->withSuccess($msg);
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
return back()->withError('Gagal hitung:')->withErrors($e->errorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
try {
|
||||
Probability::truncate();
|
||||
Classification::truncate();
|
||||
return back()->withSuccess('Perhitungan probabilitas sudah direset');
|
||||
} catch (QueryException $e) {
|
||||
return back()->withError('Gagal reset:')->withErrors($e);
|
||||
}
|
||||
}
|
||||
private static function getNumbers(string $col)
|
||||
{
|
||||
$data = ['true' => array(), 'false' => array(), 'all' => array()];
|
||||
foreach (TrainingData::select($col, 'status')->whereNotNull($col)->get() as $train) {
|
||||
if ($train['status'] == true) $data['true'][] = $train[$col];
|
||||
else $data['false'][] = $train[$col];
|
||||
$data['all'][] = $train[$col];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Classification;
|
||||
|
||||
class ResultController extends Controller
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
if (Classification::count() === 0) {
|
||||
return to_route('class.index')
|
||||
->withWarning('Lakukan klasifikasi dulu sebelum melihat performa klasifikasi');
|
||||
}
|
||||
$data['train'] = $this->cm('train');
|
||||
$data['test'] = $this->cm('test');
|
||||
$performa['train'] = $this->performa($data['train']);
|
||||
$performa['test'] = $this->performa($data['test']);
|
||||
$stat = ProbabLabel::$label;
|
||||
return view('main.performa', compact('data', 'performa', 'stat'));
|
||||
}
|
||||
private static function cm(string $type)
|
||||
{
|
||||
$tp = Classification::where('type', $type)->where('predicted', true)
|
||||
->where('real', true)->count(); //True Positive
|
||||
$fp = Classification::where('type', $type)->where('predicted', true)
|
||||
->where('real', false)->count(); //False Positive
|
||||
$fn = Classification::where('type', $type)->where('predicted', false)
|
||||
->where('real', true)->count(); //False Negative
|
||||
$tn = Classification::where('type', $type)->where('predicted', false)
|
||||
->where('real', false)->count(); //True Negative
|
||||
$total = $tp + $fp + $fn + $tn;
|
||||
return [
|
||||
'tp' => $tp,
|
||||
'fp' => $fp,
|
||||
'fn' => $fn,
|
||||
'tn' => $tn,
|
||||
'total' => $total
|
||||
];
|
||||
}
|
||||
private static function performa(array $data)
|
||||
{
|
||||
if ($data['total'] === 0) $accu = $prec = $rec = $f1 = 0;
|
||||
else {
|
||||
$accu = (($data['tp'] + $data['tn']) / $data['total']) * 100;
|
||||
$prec = ($data['tp'] / ($data['tp'] + $data['fp'])) * 100;
|
||||
$rec = ($data['tp'] / ($data['tp'] + $data['fn'])) * 100;
|
||||
$f1 = 2 * ($prec * $rec) / ($prec + $rec);
|
||||
}
|
||||
return [
|
||||
'accuracy' => $accu, 'precision' => $prec, 'recall' => $rec, 'f1' => $f1
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Exports\TestingExport;
|
||||
use App\Imports\TestingImport;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\Classification;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TestingData;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class TestingDataController extends Controller
|
||||
{
|
||||
public function export()
|
||||
{
|
||||
if (TestingData::count() === 0)
|
||||
return back()->withError('Gagal download: Data Testing kosong');
|
||||
return Excel::download(new TestingExport, 'testing.xlsx');
|
||||
}
|
||||
public function import(Request $request)
|
||||
{
|
||||
$request->validate(TestingData::$filerule);
|
||||
Excel::import(new TestingImport, request()->file('data'));
|
||||
return response()->json(['message' => 'Berhasil diimpor']);
|
||||
}
|
||||
public function count()
|
||||
{
|
||||
$test = TestingData::get();
|
||||
$testUnique = $test->unique(['nama']);
|
||||
return [
|
||||
'total' => count($test),
|
||||
'duplicate' => $test->diff($testUnique)->count()
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Tambahkan Atribut dulu sebelum menginput Dataset');
|
||||
}
|
||||
$nilai = NilaiAtribut::get();
|
||||
$calculated = Probability::count();
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view(
|
||||
'main.dataset.testing',
|
||||
compact('atribut', 'nilai', 'calculated', 'hasil')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$dt = DataTables::of(TestingData::query());
|
||||
foreach (Atribut::get() as $attr) {
|
||||
if ($attr->type === 'categorical') {
|
||||
$dt->editColumn($attr->slug, function (TestingData $test) use ($attr) {
|
||||
$atrib = NilaiAtribut::find($test[$attr->slug]);
|
||||
return $atrib->name ?? "?";
|
||||
});
|
||||
}
|
||||
}
|
||||
$dt->editColumn('status', function (TestingData $test) {
|
||||
return ProbabLabel::$label[$test->status];
|
||||
});
|
||||
return $dt->make();
|
||||
}
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->validate(TestingData::$rules);
|
||||
foreach ($request->q as $id => $q) $req[$id] = $q;
|
||||
$req['nama'] = $request->nama;
|
||||
$req['status'] = $request->status;
|
||||
Probability::truncate();
|
||||
|
||||
if (!empty($request->id)) {
|
||||
TestingData::updateOrCreate(['id' => $request->id], $req);
|
||||
return response()->json(['message' => 'Berhasil diedit']);
|
||||
} else {
|
||||
TestingData::create($req);
|
||||
return response()->json(['message' => 'Berhasil disimpan']);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(TestingData $testing)
|
||||
{
|
||||
return response()->json($testing);
|
||||
}
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(TestingData $testing)
|
||||
{
|
||||
Classification::where('name', $testing->nama)->where('type', 'test')
|
||||
->delete();
|
||||
$testing->delete();
|
||||
return response()->json(['message' => 'Berhasil dihapus']);
|
||||
}
|
||||
public function clear()
|
||||
{
|
||||
try {
|
||||
Classification::where('type', 'test')->delete();
|
||||
TestingData::truncate();
|
||||
return response()->json(['message' => 'Berhasil dihapus']);
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Exports\TrainingExport;
|
||||
use App\Imports\TrainingImport;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\Classification;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\Probability;
|
||||
use App\Models\TrainingData;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class TrainingDataController extends Controller
|
||||
{
|
||||
public function export()
|
||||
{
|
||||
if (TrainingData::count() === 0)
|
||||
return back()->withError('Gagal download: Data Training kosong');
|
||||
return Excel::download(new TrainingExport, 'training.xlsx');
|
||||
}
|
||||
public function import(Request $request)
|
||||
{
|
||||
$request->validate(TrainingData::$filerule);
|
||||
Excel::import(new TrainingImport, $request->file('data'));
|
||||
return response()->json(['message' => 'Berhasil diimpor']);
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
$train = TrainingData::get();
|
||||
$testUnique = $train->unique(['nama']);
|
||||
return [
|
||||
'total' => count($train),
|
||||
'duplicate' => $train->diff($testUnique)->count()
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$atribut = Atribut::get();
|
||||
if (count($atribut) === 0) {
|
||||
return to_route('atribut.index')
|
||||
->withWarning('Tambahkan Atribut dulu sebelum menginput Dataset');
|
||||
}
|
||||
$nilai = NilaiAtribut::get();
|
||||
$hasil = ProbabLabel::$label;
|
||||
return view('main.dataset.training', compact('atribut', 'nilai', 'hasil'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$dt = DataTables::of(TrainingData::query());
|
||||
foreach (Atribut::get() as $attr) {
|
||||
if ($attr->type === 'categorical') {
|
||||
$dt->editColumn($attr->slug, function (TrainingData $train) use ($attr) {
|
||||
$atrib = NilaiAtribut::find($train[$attr->slug]);
|
||||
return $atrib->name ?? "?";
|
||||
});
|
||||
}
|
||||
}
|
||||
$dt->editColumn('status', function (TrainingData $train) {
|
||||
return ProbabLabel::$label[$train->status];
|
||||
});
|
||||
return $dt->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->validate(TrainingData::$rules);
|
||||
foreach ($request->q as $id => $q) $req[$id] = $q;
|
||||
$req['nama'] = $request->nama;
|
||||
$req['status'] = $request->status;
|
||||
Probability::truncate();
|
||||
|
||||
if (!empty($request->id)) {
|
||||
TrainingData::updateOrCreate(['id' => $request->id], $req);
|
||||
return response()->json(['message' => 'Berhasil diedit']);
|
||||
} else {
|
||||
TrainingData::create($req);
|
||||
return response()->json(['message' => 'Berhasil disimpan']);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(TrainingData $training)
|
||||
{
|
||||
return response()->json($training);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(TrainingData $training)
|
||||
{
|
||||
Classification::where('name', $training->nama)->where('type', 'train')
|
||||
->delete();
|
||||
$training->delete();
|
||||
Probability::truncate();
|
||||
return response()->json(['message' => 'Berhasil dihapus']);
|
||||
}
|
||||
public function clear()
|
||||
{
|
||||
try {
|
||||
Classification::where('type', 'train')->delete();
|
||||
Probability::truncate();
|
||||
TrainingData::truncate();
|
||||
return response()->json(['message' => 'Berhasil dihapus']);
|
||||
} catch (QueryException $e) {
|
||||
return response()->json(['message' => $e->errorInfo[2]], 500);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = User::select('*')->whereIn('level', [1,2])->orderBy('created_at', 'desc');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return DataTables::eloquent($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('role', function($row){
|
||||
if ($row->level == 1) {
|
||||
return 'Admin';
|
||||
} else {
|
||||
return 'User';
|
||||
}
|
||||
})
|
||||
->rawColumns(['role'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
return view('main.user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('main.add-user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'level' => 'required',
|
||||
'email' => 'required',
|
||||
'password' => 'required'
|
||||
]);
|
||||
|
||||
if($validator->fails())
|
||||
{
|
||||
return redirect()->back()->with('error', 'Terjadi kesalahan pada penambahan data');
|
||||
}
|
||||
|
||||
$post = new User([
|
||||
'name' => $request->input('name'),
|
||||
'email' => $request->input('email'),
|
||||
'password' => Hash::make($request->input('password')),
|
||||
'level' => $request->input('level')
|
||||
]);
|
||||
|
||||
$check = User::where('name', $request->input('name'))->count();
|
||||
if($check == 0) {
|
||||
if($post->save()) {
|
||||
return redirect()->route('user')->with('success' , 'Data berhasil ditambahkan');
|
||||
} else {
|
||||
return redirect()->route('user')->with('error' , 'Data gagal ditambahkan');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('user')->with('error' , 'Data yang diproses telah ada sebelumnya');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
if($user) {
|
||||
return view('main.edit-user', compact('user', 'id'));
|
||||
} else {
|
||||
return redirect()->back()->with('error' , 'Data tidak ditemukan.')->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'level' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error' , 'Terdapat inputan yang masih kosong.')->withInput();
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$user = User::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($user) {
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$user->name = $request->input('name');
|
||||
$user->email = $request->input('email');
|
||||
!empty($request->input('password')) ? $user->password = bcrypt($request->input('password')) : $user->password;
|
||||
$user->level = $request->input('level');
|
||||
|
||||
// Simpan perubahan pada database
|
||||
$user->save();
|
||||
return redirect()->route('user')->with('success', 'Berhasil diperbarui');
|
||||
} else {
|
||||
return redirect()->route('user')->with('error' , 'Gagal diperbarui');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($user) {
|
||||
// Hapus data dari database
|
||||
$user->delete();
|
||||
return redirect()->route('user')->with('success', 'Berhasil dihapus akun!');
|
||||
} else {
|
||||
return redirect()->route('user')->with('error', 'Terjadi kesalahan');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
\Illuminate\Http\Middleware\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\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's middleware aliases.
|
||||
*
|
||||
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::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,
|
||||
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'isAdmin' => \App\Http\Middleware\isAdmin::class,
|
||||
];
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*/
|
||||
protected function redirectTo(Request $request): ?string
|
||||
{
|
||||
return $request->expectsJson() ? null : route('login');
|
||||
}
|
||||
}
|
|
@ -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 = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -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 = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
];
|
||||
}
|
|
@ -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(): array
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
|
@ -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 = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use App\Models\User;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class isAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (Auth::check()) {
|
||||
$user = Auth::user();
|
||||
|
||||
// Check the user's status
|
||||
if ($user->level != 1) {
|
||||
User::find(Auth::id())->update(['remember_token' => null]);
|
||||
Auth::logout();
|
||||
Session::invalidate();
|
||||
Session::regenerateToken();
|
||||
Session::flash('success', 'Anda sudah logout');
|
||||
return to_route('login');
|
||||
}
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\TestingData;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithValidation;
|
||||
|
||||
class TestingImport implements ToModel, WithHeadingRow, WithValidation
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
$rows = [];
|
||||
$rows['nama'] = $row['nama'];
|
||||
foreach (Atribut::get() as $attr) {
|
||||
if ($attr->type === 'categorical') {
|
||||
if (empty($row[$attr->slug])) $row[$attr->slug] = null;
|
||||
else {
|
||||
$foreign = NilaiAtribut::firstWhere(
|
||||
'name',
|
||||
'like',
|
||||
"%{$row[$attr->slug]}%"
|
||||
);
|
||||
$row[$attr->slug] = $foreign->id;
|
||||
}
|
||||
}
|
||||
$rows[$attr->slug] = $row[$attr->slug];
|
||||
}
|
||||
$rows['status'] = array_search( //array_search dengan teknik case insensitive
|
||||
strtolower(trim($row['hasil'])),
|
||||
array_map('strtolower', ProbabLabel::$label)
|
||||
);
|
||||
return new TestingData($rows);
|
||||
}
|
||||
public function rules(): array
|
||||
{
|
||||
$rules['nama'] = ['bail', 'required', 'string'];
|
||||
foreach (Atribut::get() as $attr) {
|
||||
if ($attr->type === 'categorical') $rules[$attr->slug] = 'string';
|
||||
else $rules[$attr->slug] = 'numeric';
|
||||
}
|
||||
$rules['hasil'] = 'required';
|
||||
return $rules;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use App\Http\Controllers\ProbabLabel;
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use App\Models\TrainingData;
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithValidation;
|
||||
|
||||
class TrainingImport implements ToModel, WithHeadingRow, WithValidation
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
*/
|
||||
public function model(array $row)
|
||||
{
|
||||
$rows = [];
|
||||
$atrib = Atribut::get();
|
||||
$rows['nama'] = $row['nama'];
|
||||
foreach ($atrib as $attr) {
|
||||
if ($attr->type === 'categorical') {
|
||||
if (empty($row[$attr->slug])) $row[$attr->slug] = null;
|
||||
else {
|
||||
$foreign = NilaiAtribut::firstWhere(
|
||||
'name',
|
||||
'like',
|
||||
"%{$row[$attr->slug]}%"
|
||||
);
|
||||
$row[$attr->slug] = $foreign->id;
|
||||
}
|
||||
}
|
||||
$rows[$attr->slug] = $row[$attr->slug];
|
||||
}
|
||||
$rows['status'] = array_search( //array_search dengan teknik case insensitive
|
||||
strtolower(trim($row['hasil'])),
|
||||
array_map('strtolower', ProbabLabel::$label)
|
||||
);
|
||||
return new TrainingData($rows);
|
||||
}
|
||||
public function rules(): array
|
||||
{
|
||||
$rules['nama'] = ['bail', 'required', 'string'];
|
||||
foreach (Atribut::get() as $attr) {
|
||||
if ($attr->type === 'categorical') $rules[$attr->slug] = 'string';
|
||||
else $rules[$attr->slug] = 'numeric';
|
||||
}
|
||||
$rules['hasil'] = 'required';
|
||||
return $rules;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
|
||||
#[Layout('components.layouts.auth')]
|
||||
class Forgot extends Component
|
||||
{
|
||||
public string $email;
|
||||
public function recoverPassword()
|
||||
{
|
||||
try {
|
||||
$cred = $this->validate(User::$forgetrules);
|
||||
$status = Password::sendResetLink($cred);
|
||||
if ($status === Password::RESET_LINK_SENT)
|
||||
$this->dispatch('sent');
|
||||
elseif ($status === Password::RESET_THROTTLED)
|
||||
$this->dispatch('error', message: "Tunggu sebentar sebelum mencoba lagi.");
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
$this->dispatch('error', message: "Terjadi kesalahan Database #{$e->errorInfo[1]}");
|
||||
} catch (TransportException $e) {
|
||||
Log::error($e);
|
||||
$this->dispatch('error', message: "Email gagal dikirim");
|
||||
}
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.forgot');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Layout('components.layouts.auth')]
|
||||
class Login extends Component
|
||||
{
|
||||
public string $email;
|
||||
public string $password;
|
||||
public bool $remember = false;
|
||||
public function login()
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate(User::$loginrules);
|
||||
if (Auth::attempt($credentials, $this->remember)) {
|
||||
$user = User::firstWhere('email', $this->email);
|
||||
Auth::login($user, $this->remember);
|
||||
Session::regenerate();
|
||||
|
||||
if(Auth::user()->level == 1) {
|
||||
$this->redirectRoute('admin');
|
||||
} else {
|
||||
$this->redirectRoute('home');
|
||||
}
|
||||
} else {
|
||||
$this->addError('email', trans('auth.failed'));
|
||||
$this->dispatch('error', message: trans('auth.failed'));
|
||||
}
|
||||
} catch (QueryException $th) {
|
||||
Log::error($th);
|
||||
$this->dispatch(
|
||||
'error',
|
||||
message: "Gagal login: Kesalahan database #{$th->errorInfo[1]}"
|
||||
);
|
||||
}
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.login');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Layout('components.layouts.auth')]
|
||||
class Register extends Component
|
||||
{
|
||||
public string $name;
|
||||
public string $email;
|
||||
public string $password;
|
||||
public string $password_confirmation;
|
||||
public function register()
|
||||
{
|
||||
try {
|
||||
$this->validate(User::$rules);
|
||||
User::create([
|
||||
'name' => $this->name,
|
||||
'email' => Str::lower($this->email),
|
||||
'password' => Hash::make($this->password)
|
||||
]);
|
||||
session()->flash('success', 'Akun sudah dibuat.');
|
||||
$this->redirectRoute('login');
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
$this->dispatch('error', message: "Kesalahan Database {$e->errorInfo[1]}");
|
||||
}
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.register');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Layout('components.layouts.auth')]
|
||||
class Reset extends Component
|
||||
{
|
||||
public string $email;
|
||||
public string $token;
|
||||
public string $password;
|
||||
public string $password_confirmation;
|
||||
public function mount()
|
||||
{
|
||||
try {
|
||||
$enctoken = DB::table('password_reset_tokens')
|
||||
->where('email', $_GET['email'])->first();
|
||||
if ($enctoken === null) {
|
||||
session()->flash('error', __('passwords.user'));
|
||||
$this->redirectRoute('password.request');
|
||||
}
|
||||
$this->email = $_GET['email'];
|
||||
$this->token = $_GET['token'];
|
||||
} catch (QueryException $e) {
|
||||
Log::error($e);
|
||||
session()->flash('error', "Terjadi kesalahan database #{$e->errorInfo[1]}");
|
||||
$this->redirectRoute('password.forget');
|
||||
}
|
||||
}
|
||||
public function resetPassword()
|
||||
{
|
||||
$data = $this->validate(User::$resetrules);
|
||||
$status = Password::reset(
|
||||
$data,
|
||||
function (User $user, string $password) {
|
||||
$user->forceFill(['password' => Hash::make($password)]);
|
||||
$user->save();
|
||||
event(new PasswordReset($user));
|
||||
}
|
||||
);
|
||||
if ($status === Password::PASSWORD_RESET) {
|
||||
session()->flash('success', __('passwords.reset'));
|
||||
$this->redirectRoute('login');
|
||||
} elseif ($status === Password::INVALID_TOKEN)
|
||||
$this->dispatch('error', message: __('passwords.token'));
|
||||
elseif ($status === Password::INVALID_USER)
|
||||
$this->dispatch('error', message: __('passwords.user'));
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.reset');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Atribut extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['name', 'slug', 'type', 'desc'];
|
||||
public static array $rules = [
|
||||
'name' => 'required',
|
||||
'type' => ['bail', 'required', 'in:numeric,categorical']
|
||||
], $tipe = ['numeric' => 'Numerik', 'categorical' => 'Kategorikal'];
|
||||
public function nilai_atribut()
|
||||
{
|
||||
return $this->hasOne(NilaiAtribut::class, 'atribut_id');
|
||||
}
|
||||
public function probability()
|
||||
{
|
||||
return $this->hasOne(Probability::class, 'atribut_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Classification extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['name', 'type', 'true', 'false', 'predicted', 'real'];
|
||||
public static array $rule = ['tipe' => ['bail', 'required', 'in:train,test,all']],
|
||||
$tipedata = ['train' => 'Training', 'test' => 'Testing'];
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NilaiAtribut extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = ['atribut_id', 'name'];
|
||||
public static array $rules = [
|
||||
'atribut_id' => ['bail', 'required', 'exists:atributs,id'],
|
||||
'name' => 'required'
|
||||
];
|
||||
public function atribut()
|
||||
{
|
||||
return $this->belongsTo(Atribut::class, 'atribut_id');
|
||||
}
|
||||
public function probability()
|
||||
{
|
||||
return $this->hasOne(Probability::class, 'nilai_atribut_id');
|
||||
}
|
||||
public function training_data()
|
||||
{
|
||||
return $this->hasMany(TrainingData::class);
|
||||
}
|
||||
public function testing_data()
|
||||
{
|
||||
return $this->hasMany(TestingData::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Probability extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'atribut_id', 'nilai_atribut_id', 'true', 'false', 'total'
|
||||
];
|
||||
public function atribut()
|
||||
{
|
||||
return $this->belongsTo(Atribut::class, 'atribut_id');
|
||||
}
|
||||
public function nilai_atribut()
|
||||
{
|
||||
return $this->belongsTo(NilaiAtribut::class, 'nilai_atribut_id');
|
||||
}
|
||||
public static function probabKelas()
|
||||
{
|
||||
$total = TrainingData::count();
|
||||
if ($total === 0) $true = $false = 0;
|
||||
else {
|
||||
$true = TrainingData::where('status', true)->count() / $total;
|
||||
$false = TrainingData::where('status', false)->count() / $total;
|
||||
}
|
||||
return ['true' => $true, 'false' => $false];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TestingData extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
public static array $rules = [
|
||||
'nama' => ['bail', 'required', 'string'],
|
||||
'q' => 'required',
|
||||
'q.*' => ['bail', 'required', 'numeric'],
|
||||
'status' => ['bail', 'required', 'in:1,0,true,false,auto']
|
||||
], $filerule = [
|
||||
'data' => [
|
||||
'bail',
|
||||
'required',
|
||||
'file',
|
||||
'mimetypes:application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet,text/csv,text/tab-separated-values'
|
||||
]
|
||||
];
|
||||
public function nilaiatribut()
|
||||
{
|
||||
return $this->belongsTo(NilaiAtribut::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TrainingData extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
public static array $rules = [
|
||||
'nama' => ['bail', 'required', 'string'],
|
||||
'status' => ['bail', 'required', 'boolean'],
|
||||
'q' => 'required',
|
||||
'q.*' => ['bail', 'required', 'numeric']
|
||||
], $filerule = [
|
||||
'data' => [
|
||||
'bail',
|
||||
'required',
|
||||
'file',
|
||||
'mimetypes:application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet,text/csv,text/tab-separated-values'
|
||||
]
|
||||
];
|
||||
public function nilaiatribut()
|
||||
{
|
||||
return $this->belongsTo(NilaiAtribut::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
<?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 = ['name', 'email', 'password', 'level'];
|
||||
|
||||
/**
|
||||
* 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', 'password' => 'hashed'];
|
||||
public static array $rules = [
|
||||
'name' => ['bail', 'required', 'string'],
|
||||
'email' => ['bail', 'required', 'email', 'unique:users'],
|
||||
'password' => ['bail', 'required', 'confirmed', 'between:6,20'],
|
||||
'password_confirmation' => 'required'
|
||||
], $updrules = [
|
||||
'name' => ['bail', 'required', 'string'],
|
||||
'email' => ['bail', 'required', 'email', 'unique:users'],
|
||||
'level' => ['required'],
|
||||
'password' => ['nullable', 'bail', 'confirmed', 'between:6,20'],
|
||||
'password_confirmation' => 'required_with:password'
|
||||
], $loginrules = [
|
||||
'email' => ['bail', 'required', 'email'],
|
||||
'password' => ['bail', 'required', 'between:6,20']
|
||||
], $forgetrules = ['email' => ['bail', 'required', 'email', 'exists:users']],
|
||||
$resetrules = [
|
||||
'email' => ['bail', 'required', 'email', 'exists:users'],
|
||||
'password' => ['bail', 'required', 'confirmed', 'between:6,20'],
|
||||
'password_confirmation' => 'required',
|
||||
'token' => 'required'
|
||||
], $delrules = [
|
||||
'confirm_pass' => ['bail', 'required', 'current_password', 'between:6,20']
|
||||
], $userrules = [
|
||||
'name' => ['bail', 'required', 'string'],
|
||||
'email' => ['bail', 'required', 'email', 'unique:users'],
|
||||
'level' => ['required'],
|
||||
'password' => ['bail', 'required', 'confirmed', 'between:6,20'],
|
||||
'password_confirmation' => 'required',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Gate::define('manage_users', function(User $user) {
|
||||
return $user->is_admin == 1;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?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 to 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.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*/
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?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 your application's "home" route.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
RateLimiter::for('user', function (Request $request) {
|
||||
return Limit::perMinutes(3, 3)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')->prefix('api')->group(base_path('routes/api.php'));
|
||||
Route::middleware('web')->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
trait Excludable
|
||||
{
|
||||
/**
|
||||
* Get the array of columns
|
||||
* @return mixed
|
||||
*/
|
||||
private function getTableColumns()
|
||||
{
|
||||
return $this->getConnection()->getSchemaBuilder()->getColumnListing($this->getTable());
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude an array of elements from the result.
|
||||
* @param $query
|
||||
* @param $columns
|
||||
* @return mixed
|
||||
*/
|
||||
public function scopeExclude($query, $columns)
|
||||
{
|
||||
return $query->select(array_diff($this->getTableColumns(), (array) $columns));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Alert extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.alert');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class BackToHome extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.back-to-home');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class CapsLock extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.caps-lock');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class NoScript extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.no-script');
|
||||
}
|
||||
}
|
|
@ -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);
|
|
@ -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;
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^10.10",
|
||||
"laravel/sanctum": "^3.3",
|
||||
"laravel/tinker": "^2.8",
|
||||
"livewire/livewire": "^3.4",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"orangehill/iseed": "^3.0",
|
||||
"yajra/laravel-datatables-oracle": "^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"spatie/laravel-ignition": "^2.0"
|
||||
},
|
||||
"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,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
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'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => 'Asia/Jakarta',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => 'file',
|
||||
// 'store' => 'redis',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => ServiceProvider::defaultProviders()->merge([
|
||||
/*
|
||||
* 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,
|
||||
])->toArray(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => Facade::defaultAliases()->merge([
|
||||
// 'Example' => App\Facades\Example::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
|
@ -0,0 +1,115 @@
|
|||
<?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 expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_reset_tokens',
|
||||
'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,
|
||||
|
||||
];
|
|
@ -0,0 +1,71 @@
|
|||
<?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'),
|
||||
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,111 @@
|
|||
<?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'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
'lock_connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||
| stores there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
|
@ -0,0 +1,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,
|
||||
|
||||
];
|
|
@ -0,0 +1,151 @@
|
|||
<?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,
|
||||
'search_path' => '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,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run 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'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,379 @@
|
|||
<?php
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
return [
|
||||
'exports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Chunk size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using FromQuery, the query is automatically chunked.
|
||||
| Here you can specify how big the chunk should be.
|
||||
|
|
||||
*/
|
||||
'chunk_size' => 1000,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pre-calculate formulas during export
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'pre_calculate_formulas' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable strict null comparison
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When enabling strict null comparison empty cells ('') will
|
||||
| be added to the sheet.
|
||||
*/
|
||||
'strict_null_comparison' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => ',',
|
||||
'enclosure' => '"',
|
||||
'line_ending' => PHP_EOL,
|
||||
'use_bom' => false,
|
||||
'include_separator_line' => false,
|
||||
'excel_compatibility' => false,
|
||||
'output_encoding' => '',
|
||||
'test_auto_detect' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
],
|
||||
|
||||
'imports' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Read Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might only be interested in the
|
||||
| data that the sheet exists. By default we ignore all styles,
|
||||
| however if you want to do some logic based on style data
|
||||
| you can enable it by setting read_only to false.
|
||||
|
|
||||
*/
|
||||
'read_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignore Empty
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with imports, you might be interested in ignoring
|
||||
| rows that have null values or empty strings. By default rows
|
||||
| containing empty strings or empty values are not ignored but can be
|
||||
| ignored by enabling the setting ignore_empty to true.
|
||||
|
|
||||
*/
|
||||
'ignore_empty' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Heading Row Formatter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure the heading row formatter.
|
||||
| Available options: none|slug|custom
|
||||
|
|
||||
*/
|
||||
'heading_row' => [
|
||||
'formatter' => 'slug',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CSV Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => null,
|
||||
'enclosure' => '"',
|
||||
'escape_character' => '\\',
|
||||
'contiguous' => false,
|
||||
'input_encoding' => 'UTF-8',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Worksheet properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure e.g. default title, creator, subject,...
|
||||
|
|
||||
*/
|
||||
'properties' => [
|
||||
'creator' => '',
|
||||
'lastModifiedBy' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'subject' => '',
|
||||
'keywords' => '',
|
||||
'category' => '',
|
||||
'manager' => '',
|
||||
'company' => '',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cell Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure middleware that is executed on getting a cell value
|
||||
|
|
||||
*/
|
||||
'cells' => [
|
||||
'middleware' => [
|
||||
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
|
||||
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extension detector
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which writer/reader type should be used when the package
|
||||
| needs to guess the correct type based on the extension alone.
|
||||
|
|
||||
*/
|
||||
'extension_detector' => [
|
||||
'xlsx' => Excel::XLSX,
|
||||
'xlsm' => Excel::XLSX,
|
||||
'xltx' => Excel::XLSX,
|
||||
'xltm' => Excel::XLSX,
|
||||
'xls' => Excel::XLS,
|
||||
'xlt' => Excel::XLS,
|
||||
'ods' => Excel::ODS,
|
||||
'ots' => Excel::ODS,
|
||||
'slk' => Excel::SLK,
|
||||
'xml' => Excel::XML,
|
||||
'gnumeric' => Excel::GNUMERIC,
|
||||
'htm' => Excel::HTML,
|
||||
'html' => Excel::HTML,
|
||||
'csv' => Excel::CSV,
|
||||
'tsv' => Excel::TSV,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| PDF Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure here which Pdf driver should be used by default.
|
||||
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
||||
|
|
||||
*/
|
||||
'pdf' => Excel::DOMPDF,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Value Binder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| PhpSpreadsheet offers a way to hook into the process of a value being
|
||||
| written to a cell. In there some assumptions are made on how the
|
||||
| value should be formatted. If you want to change those defaults,
|
||||
| you can implement your own default value binder.
|
||||
|
|
||||
| Possible value binders:
|
||||
|
|
||||
| [x] Maatwebsite\Excel\DefaultValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
|
||||
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
||||
|
|
||||
*/
|
||||
'value_binder' => [
|
||||
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default cell caching driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default PhpSpreadsheet keeps all cell values in memory, however when
|
||||
| dealing with large files, this might result into memory issues. If you
|
||||
| want to mitigate that, you can configure a cell caching driver here.
|
||||
| When using the illuminate driver, it will store each value in the
|
||||
| cache store. This can slow down the process, because it needs to
|
||||
| store each value. You can use the "batch" store if you want to
|
||||
| only persist to the store when the memory limit is reached.
|
||||
|
|
||||
| Drivers: memory|illuminate|batch
|
||||
|
|
||||
*/
|
||||
'driver' => 'memory',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Batch memory caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with the "batch" caching driver, it will only
|
||||
| persist to the store when the memory limit is reached.
|
||||
| Here you can tweak the memory limit to your liking.
|
||||
|
|
||||
*/
|
||||
'batch' => [
|
||||
'memory_limit' => 60000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Illuminate cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "illuminate" caching driver, it will automatically use
|
||||
| your default cache store. However if you prefer to have the cell
|
||||
| cache on a separate store, you can configure the store name here.
|
||||
| You can use any store defined in your cache config. When leaving
|
||||
| at "null" it will use the default store.
|
||||
|
|
||||
*/
|
||||
'illuminate' => [
|
||||
'store' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Time-to-live (TTL)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The TTL of items written to cache. If you want to keep the items cached
|
||||
| indefinitely, set this to null. Otherwise, set a number of seconds,
|
||||
| a \DateInterval, or a callable.
|
||||
|
|
||||
| Allowable types: callable|\DateInterval|int|null
|
||||
|
|
||||
*/
|
||||
'default_ttl' => 10800,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Transaction Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default the import is wrapped in a transaction. This is useful
|
||||
| for when an import may fail and you want to retry it. With the
|
||||
| transactions, the previous import gets rolled-back.
|
||||
|
|
||||
| You can disable the transaction handler by setting this to null.
|
||||
| Or you can choose a custom made transaction handler here.
|
||||
|
|
||||
| Supported handlers: null|db
|
||||
|
|
||||
*/
|
||||
'transactions' => [
|
||||
'handler' => 'db',
|
||||
'db' => [
|
||||
'connection' => null,
|
||||
],
|
||||
],
|
||||
|
||||
'temporary_files' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Local Temporary Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When exporting and importing files, we use a temporary file, before
|
||||
| storing reading or downloading. Here you can customize that path.
|
||||
| permissions is an array with the permission flags for the directory (dir)
|
||||
| and the create file (file).
|
||||
|
|
||||
*/
|
||||
'local_path' => storage_path('framework/cache/laravel-excel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Local Temporary Path Permissions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Permissions is an array with the permission flags for the directory (dir)
|
||||
| and the create file (file).
|
||||
| If omitted the default permissions of the filesystem will be used.
|
||||
|
|
||||
*/
|
||||
'local_permissions' => [
|
||||
// 'dir' => 0755,
|
||||
// 'file' => 0644,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Temporary Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup with queues in which you
|
||||
| cannot rely on having a shared local temporary path, you might
|
||||
| want to store the temporary file on a shared disk. During the
|
||||
| queue executing, we'll retrieve the temporary file from that
|
||||
| location instead. When left to null, it will always use
|
||||
| the local path. This setting only has effect when using
|
||||
| in conjunction with queued imports and exports.
|
||||
|
|
||||
*/
|
||||
'remote_disk' => null,
|
||||
'remote_prefix' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force Resync
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When dealing with a multi server setup as above, it's possible
|
||||
| for the clean up that occurs after entire queue has been run to only
|
||||
| cleanup the server that the last AfterImportJob runs on. The rest of the server
|
||||
| would still have the local temporary file stored on it. In this case your
|
||||
| local storage limits can be exceeded and future imports won't be processed.
|
||||
| To mitigate this you can set this config value to be true, so that after every
|
||||
| queued chunk is processed the local temporary file is deleted on the server that
|
||||
| processed it.
|
||||
|
|
||||
*/
|
||||
'force_resync_remote' => null,
|
||||
],
|
||||
];
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', '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 set up for each driver as an example of the required values.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,54 @@
|
|||
<?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', 12),
|
||||
'verify' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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,
|
||||
'verify' => true,
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Class Namespace
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value sets the root class namespace for Livewire component classes in
|
||||
| your application. This value will change where component auto-discovery
|
||||
| finds components. It's also referenced by the file creation commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'class_namespace' => 'App\\Livewire',
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| View Path
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value is used to specify where Livewire component Blade templates are
|
||||
| stored when running file creation commands like `artisan make:livewire`.
|
||||
| It is also used if you choose to omit a component's render() method.
|
||||
|
|
||||
*/
|
||||
|
||||
'view_path' => resource_path('views/livewire'),
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Layout
|
||||
|---------------------------------------------------------------------------
|
||||
| The view that will be used as the layout when rendering a single component
|
||||
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
|
||||
| In this case, the view returned by CreatePost will render into $slot.
|
||||
|
|
||||
*/
|
||||
|
||||
'layout' => 'components.layouts.app',
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Lazy Loading Placeholder
|
||||
|---------------------------------------------------------------------------
|
||||
| Livewire allows you to lazy load components that would otherwise slow down
|
||||
| the initial page load. Every component can have a custom placeholder or
|
||||
| you can define the default placeholder view for all components below.
|
||||
|
|
||||
*/
|
||||
|
||||
'lazy_placeholder' => null,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Temporary File Uploads
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Livewire handles file uploads by storing uploads in a temporary directory
|
||||
| before the file is stored permanently. All file uploads are directed to
|
||||
| a global endpoint for temporary storage. You may configure this below:
|
||||
|
|
||||
*/
|
||||
|
||||
'temporary_file_upload' => [
|
||||
'disk' => null, // Example: 'local', 's3' | Default: 'default'
|
||||
'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
|
||||
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
|
||||
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
|
||||
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
|
||||
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
|
||||
'mov', 'avi', 'wmv', 'mp3', 'm4a',
|
||||
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
|
||||
],
|
||||
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
|
||||
],
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Render On Redirect
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines if Livewire will run a component's `render()` method
|
||||
| after a redirect has been triggered using something like `redirect(...)`
|
||||
| Setting this to true will render the view once more before redirecting
|
||||
|
|
||||
*/
|
||||
|
||||
'render_on_redirect' => false,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Eloquent Model Binding
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Previous versions of Livewire supported binding directly to eloquent model
|
||||
| properties using wire:model by default. However, this behavior has been
|
||||
| deemed too "magical" and has therefore been put under a feature flag.
|
||||
|
|
||||
*/
|
||||
|
||||
'legacy_model_binding' => false,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Auto-inject Frontend Assets
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| By default, Livewire automatically injects its JavaScript and CSS into the
|
||||
| <head> and <body> of pages containing Livewire components. By disabling
|
||||
| this behavior, you need to use @livewireStyles and @livewireScripts.
|
||||
|
|
||||
*/
|
||||
|
||||
'inject_assets' => true,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Navigate (SPA mode)
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| By adding `wire:navigate` to links in your Livewire application, Livewire
|
||||
| will prevent the default link handling and instead request those pages
|
||||
| via AJAX, creating an SPA-like effect. Configure this behavior here.
|
||||
|
|
||||
*/
|
||||
|
||||
'navigate' => [
|
||||
'show_progress_bar' => true,
|
||||
'progress_bar_color' => '#2299dd',
|
||||
],
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| HTML Morph Markers
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| Livewire intelligently "morphs" existing HTML into the newly rendered HTML
|
||||
| after each update. To make this process more reliable, Livewire injects
|
||||
| "markers" into the rendered Blade surrounding @if, @class & @foreach.
|
||||
|
|
||||
*/
|
||||
|
||||
'inject_morph_markers' => false,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Pagination Theme
|
||||
|---------------------------------------------------------------------------
|
||||
|
|
||||
| When enabling Livewire's pagination feature by using the `WithPagination`
|
||||
| trait, Livewire will use Tailwind templates to render pagination views
|
||||
| on the page. If you want Bootstrap CSS, you can specify: "bootstrap"
|
||||
|
|
||||
*/
|
||||
|
||||
'pagination_theme' => 'tailwind',
|
||||
];
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that 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' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => 14,
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => LOG_USER,
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,134 @@
|
|||
<?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", "ses-v2",
|
||||
| "postmark", "log", "array", "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => null,
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,109 @@
|
|||
<?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,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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',
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. This will override any values set in the token's
|
||||
| "expires_at" attribute, but first-party sessions are not affected.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Token Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Sanctum can prefix new tokens in order to take advantage of numerous
|
||||
| security scanning initiatives maintained by open source platforms
|
||||
| that notify developers if they commit tokens into repositories.
|
||||
|
|
||||
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
||||
|
|
||||
*/
|
||||
|
||||
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
'scheme' => 'https',
|
||||
],
|
||||
|
||||
'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'),
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,214 @@
|
|||
<?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'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => false,
|
||||
|
||||
];
|
|
@ -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'))
|
||||
),
|
||||
|
||||
];
|
|
@ -0,0 +1 @@
|
|||
*.sqlite*
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
|
@ -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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('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->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('atributs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 99);
|
||||
$table->string('slug', 99)->unique();
|
||||
$table->enum('type', ['numeric', 'categorical']);
|
||||
$table->string('desc')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('atributs');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Atribut;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('nilai_atributs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Atribut::class)->cascadeOnDelete();
|
||||
$table->string('name', 99);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('nilai_atributs');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('training_data', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nama', 99);
|
||||
$table->foreignId('rumah')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->foreignId('pekerjaan')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->integer('penghasilan')->nullable();
|
||||
$table->foreignId('listrik')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->integer('tanggungan')->nullable();
|
||||
$table->boolean('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('training_data');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('testing_data', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nama', 99);
|
||||
$table->foreignId('rumah')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->foreignId('pekerjaan')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->integer('penghasilan')->nullable();
|
||||
$table->foreignId('listrik')->nullable()->constrained('nilai_atributs')
|
||||
->nullOnDelete()->cascadeOnUpdate();
|
||||
$table->integer('tanggungan')->nullable();
|
||||
$table->boolean('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('testing_data');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Atribut;
|
||||
use App\Models\NilaiAtribut;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('probabilities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Atribut::class)->cascadeOnDelete();
|
||||
$table->foreignIdFor(NilaiAtribut::class)->nullable()
|
||||
->cascadeOnDelete()->comment('Kategorikal saja');
|
||||
$table->jsonb('true');
|
||||
$table->jsonb('false');
|
||||
$table->jsonb('total');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('probabilities');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('classifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 99);
|
||||
$table->enum('type', ['train', 'test']);
|
||||
$table->double('true', 25, 20)->default(0.00);
|
||||
$table->double('false', 25, 20)->default(0.00);
|
||||
$table->boolean('predicted')->comment('Kelas prediksi');
|
||||
$table->boolean('real')->comment('Kelas asli');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('classifications');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Atribut;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AtributSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Atribut::insert([
|
||||
['name' => 'Rumah', 'slug' => 'rumah', 'type' => 'categorical'],
|
||||
['name' => 'Pekerjaan', 'slug' => 'pekerjaan', 'type' => 'categorical'],
|
||||
['name' => 'Penghasilan', 'slug' => 'penghasilan', 'type' => 'numeric'],
|
||||
['name' => 'Listrik', 'slug' => 'listrik', 'type' => 'categorical'],
|
||||
['name' => 'Tanggungan', 'slug' => 'tanggungan', 'type' => 'numeric']
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
\App\Models\User::factory()->create([
|
||||
'name' => 'Test User', 'email' => 'test@example.com'
|
||||
]);
|
||||
$this->call([AtributSeeder::class, NilaiAtributSeeder::class]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\NilaiAtribut;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NilaiAtributSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
NilaiAtribut::insert([
|
||||
['atribut_id' => 1, 'name' => 'Milik sendiri'],
|
||||
['atribut_id' => 1, 'name' => 'Menumpang'],
|
||||
['atribut_id' => 1, 'name' => 'Sewa'],
|
||||
['atribut_id' => 2, 'name' => 'Wiraswasta'],
|
||||
['atribut_id' => 2, 'name' => 'Wirausaha'],
|
||||
['atribut_id' => 2, 'name' => 'Buruh'],
|
||||
['atribut_id' => 2, 'name' => 'Pensiunan'],
|
||||
['atribut_id' => 2, 'name' => 'Guru'],
|
||||
['atribut_id' => 2, 'name' => 'Karyawan swasta'],
|
||||
['atribut_id' => 2, 'name' => 'Catering'],
|
||||
['atribut_id' => 4, 'name' => '450 VA'],
|
||||
['atribut_id' => 4, 'name' => '900 VA']
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,491 @@
|
|||
-- phpMyAdmin SQL Dump
|
||||
-- version 5.2.0
|
||||
-- https://www.phpmyadmin.net/
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Generation Time: May 23, 2024 at 02:54 PM
|
||||
-- Server version: 5.7.33
|
||||
-- PHP Version: 8.1.22
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
--
|
||||
-- Database: `naif`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `atributs`
|
||||
--
|
||||
|
||||
CREATE TABLE `atributs` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`slug` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`type` enum('numeric','categorical') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`desc` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `atributs`
|
||||
--
|
||||
|
||||
INSERT INTO `atributs` (`id`, `name`, `slug`, `type`, `desc`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'pH', 'ph', 'categorical', NULL, '2024-05-07 05:53:51', '2024-05-07 05:53:51'),
|
||||
(2, 'Suhu', 'suhu', 'categorical', NULL, '2024-05-07 05:54:08', '2024-05-07 05:54:08'),
|
||||
(3, 'Kelembapan', 'kelembapan', 'categorical', NULL, '2024-05-07 05:54:16', '2024-05-07 05:54:16'),
|
||||
(4, 'Tekstur Tanah', 'tekstur_tanah', 'categorical', NULL, '2024-05-07 05:54:39', '2024-05-07 05:54:39');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `classifications`
|
||||
--
|
||||
|
||||
CREATE TABLE `classifications` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`type` enum('train','test') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`true` double(25,20) NOT NULL DEFAULT '0.00000000000000000000',
|
||||
`false` double(25,20) NOT NULL DEFAULT '0.00000000000000000000',
|
||||
`predicted` tinyint(1) NOT NULL COMMENT 'Kelas prediksi',
|
||||
`real` tinyint(1) NOT NULL COMMENT 'Kelas asli',
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `classifications`
|
||||
--
|
||||
|
||||
INSERT INTO `classifications` (`id`, `name`, `type`, `true`, `false`, `predicted`, `real`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'T1', 'train', 0.39183673469388000000, 0.24489795918367000000, 1, 1, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(2, 'T2', 'train', 0.13061224489796000000, 0.70530612244898000000, 0, 0, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(3, 'T3', 'train', 1.95918367346939970000, 0.04353741496598600000, 1, 1, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(4, 'T4', 'train', 1.22448979591840000000, 0.08163265306122400000, 1, 1, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(5, 'T5', 'train', 0.05224489795918401000, 1.76326530612240000000, 0, 0, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(6, 'T6', 'train', 0.39183673469388000000, 0.24489795918367000000, 1, 1, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(7, 'T7', 'train', 1.46938775510200000000, 0.06530612244898000000, 1, 0, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(8, 'T8', 'train', 0.09795918367346900000, 0.97959183673469000000, 0, 0, '2024-05-23 12:12:32', '2024-05-23 12:12:32'),
|
||||
(9, 'T9', 'train', 0.10884353741496999000, 0.81632653061224000000, 0, 0, '2024-05-23 12:12:33', '2024-05-23 12:12:33'),
|
||||
(10, 'T10', 'train', 0.97959183673469000000, 0.09795918367346900000, 1, 1, '2024-05-23 12:12:33', '2024-05-23 12:12:33'),
|
||||
(11, 'T11', 'train', 0.06530612244898000000, 1.46938775510200000000, 0, 0, '2024-05-23 12:12:33', '2024-05-23 12:12:33'),
|
||||
(12, 'T12', 'train', 0.06530612244898000000, 1.46938775510200000000, 0, 0, '2024-05-23 12:12:33', '2024-05-23 12:12:33'),
|
||||
(13, 'T13', 'train', 1.95918367346939970000, 0.04353741496598600000, 1, 1, '2024-05-23 12:12:33', '2024-05-23 12:12:33'),
|
||||
(14, 'T14', 'train', 0.19591836734694000000, 0.47020408163264993000, 0, 1, '2024-05-23 12:12:33', '2024-05-23 12:12:33');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `failed_jobs`
|
||||
--
|
||||
|
||||
CREATE TABLE `failed_jobs` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `migrations`
|
||||
--
|
||||
|
||||
CREATE TABLE `migrations` (
|
||||
`id` int(10) UNSIGNED NOT NULL,
|
||||
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`batch` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `migrations`
|
||||
--
|
||||
|
||||
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
|
||||
(1, '2014_10_12_000000_create_users_table', 1),
|
||||
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
|
||||
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
|
||||
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
|
||||
(5, '2024_02_23_112052_create_atributs_table', 1),
|
||||
(6, '2024_02_24_074346_create_nilai_atributs_table', 1),
|
||||
(7, '2024_02_24_143423_create_training_data_table', 1),
|
||||
(8, '2024_02_24_143435_create_testing_data_table', 1),
|
||||
(9, '2024_02_24_144557_create_probabilities_table', 1),
|
||||
(10, '2024_02_24_144607_create_classifications_table', 1);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `nilai_atributs`
|
||||
--
|
||||
|
||||
CREATE TABLE `nilai_atributs` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`atribut_id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `nilai_atributs`
|
||||
--
|
||||
|
||||
INSERT INTO `nilai_atributs` (`id`, `atribut_id`, `name`, `created_at`, `updated_at`) VALUES
|
||||
(13, 1, 'netral', '2024-05-07 05:54:57', '2024-05-07 05:54:57'),
|
||||
(14, 1, 'asam', '2024-05-07 05:55:05', '2024-05-07 05:55:05'),
|
||||
(15, 1, 'basa', '2024-05-07 05:55:10', '2024-05-07 05:55:10'),
|
||||
(16, 2, 'panas', '2024-05-07 05:55:22', '2024-05-07 05:55:22'),
|
||||
(17, 2, 'hangat', '2024-05-07 05:55:27', '2024-05-07 05:55:27'),
|
||||
(18, 2, 'dingin', '2024-05-07 05:55:33', '2024-05-07 05:55:33'),
|
||||
(19, 3, 'tinggi', '2024-05-07 05:55:54', '2024-05-07 05:55:54'),
|
||||
(20, 3, 'rendah', '2024-05-07 05:55:59', '2024-05-07 05:55:59'),
|
||||
(21, 4, 'keras', '2024-05-07 05:56:12', '2024-05-07 05:56:12'),
|
||||
(22, 4, 'lunak', '2024-05-07 05:56:18', '2024-05-07 05:56:18');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `password_reset_tokens`
|
||||
--
|
||||
|
||||
CREATE TABLE `password_reset_tokens` (
|
||||
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `personal_access_tokens`
|
||||
--
|
||||
|
||||
CREATE TABLE `personal_access_tokens` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`tokenable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`token` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`abilities` text COLLATE utf8mb4_unicode_ci,
|
||||
`last_used_at` timestamp NULL DEFAULT NULL,
|
||||
`expires_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `probabilities`
|
||||
--
|
||||
|
||||
CREATE TABLE `probabilities` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`atribut_id` bigint(20) UNSIGNED NOT NULL,
|
||||
`nilai_atribut_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Kategorikal saja',
|
||||
`true` json NOT NULL,
|
||||
`false` json NOT NULL,
|
||||
`total` json NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `probabilities`
|
||||
--
|
||||
|
||||
INSERT INTO `probabilities` (`id`, `atribut_id`, `nilai_atribut_id`, `true`, `false`, `total`, `created_at`, `updated_at`) VALUES
|
||||
(1, 1, 13, '0.42857142857142855', '0.42857142857142855', '0.42857142857142855', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(2, 1, 14, '0.2857142857142857', '0.14285714285714285', '0.21428571428571427', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(3, 1, 15, '0.2857142857142857', '0.42857142857142855', '0.35714285714285715', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(4, 2, 16, '0.2857142857142857', '0.42857142857142855', '0.35714285714285715', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(5, 2, 17, '0.42857142857142855', '0.2857142857142857', '0.35714285714285715', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(6, 2, 18, '0.2857142857142857', '0.2857142857142857', '0.2857142857142857', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(7, 3, 19, '0.8571428571428571', '0.14285714285714285', '0.5', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(8, 3, 20, '0.14285714285714285', '0.8571428571428571', '0.5', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(9, 4, 21, '0.2857142857142857', '0.7142857142857143', '0.5', '2024-05-23 12:11:45', '2024-05-23 12:11:45'),
|
||||
(10, 4, 22, '0.7142857142857143', '0.2857142857142857', '0.5', '2024-05-23 12:11:45', '2024-05-23 12:11:45');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `testing_data`
|
||||
--
|
||||
|
||||
CREATE TABLE `testing_data` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`nama` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`rumah` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`pekerjaan` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`penghasilan` int(11) DEFAULT NULL,
|
||||
`listrik` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`tanggungan` int(11) DEFAULT NULL,
|
||||
`status` tinyint(1) NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`ph` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`suhu` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`kelembapan` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`tekstur_tanah` bigint(20) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `training_data`
|
||||
--
|
||||
|
||||
CREATE TABLE `training_data` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`nama` varchar(99) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`status` tinyint(1) NOT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`ph` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`suhu` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`kelembapan` bigint(20) UNSIGNED DEFAULT NULL,
|
||||
`tekstur_tanah` bigint(20) UNSIGNED DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `training_data`
|
||||
--
|
||||
|
||||
INSERT INTO `training_data` (`id`, `nama`, `status`, `created_at`, `updated_at`, `ph`, `suhu`, `kelembapan`, `tekstur_tanah`) VALUES
|
||||
(1, 'T1', 1, '2024-05-07 05:57:59', '2024-05-23 06:25:53', 13, 16, 19, 21),
|
||||
(2, 'T2', 0, '2024-05-07 05:58:42', '2024-05-23 12:10:15', 15, 16, 20, 22),
|
||||
(3, 'T3', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 14, 17, 19, 22),
|
||||
(4, 'T4', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 13, 18, 19, 22),
|
||||
(5, 'T5', 0, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 15, 16, 20, 21),
|
||||
(6, 'T6', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 15, 18, 19, 21),
|
||||
(7, 'T7', 0, '2024-05-07 06:06:17', '2024-05-23 06:25:27', 13, 17, 19, 22),
|
||||
(8, 'T8', 0, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 13, 17, 20, 21),
|
||||
(9, 'T9', 0, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 14, 18, 20, 21),
|
||||
(10, 'T10', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 13, 16, 19, 22),
|
||||
(11, 'T11', 0, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 15, 18, 20, 21),
|
||||
(12, 'T12', 0, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 13, 16, 20, 21),
|
||||
(13, 'T13', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 14, 17, 19, 22),
|
||||
(14, 'T14', 1, '2024-05-07 06:06:17', '2024-05-07 06:06:17', 15, 17, 20, 22);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`email_verified_at` timestamp NULL DEFAULT NULL,
|
||||
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`level` int(3) NOT NULL DEFAULT '1',
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Dumping data for table `users`
|
||||
--
|
||||
|
||||
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `level`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'Test User', 'test@example.com', '2024-05-01 15:06:53', '$2y$12$jjLWEez18pnqDK4wjJ1Qeeb8YIhYc9kypNcCt5fwyYvzgzDy2lb0S', '3VQxqVaNjVnCqOoHmFqESO3ysWzyTOvG0hqpm4AWPW6p2TvGeEU14Y4uUmnM', 1, '2024-05-01 15:06:54', '2024-05-01 15:06:54'),
|
||||
(2, 'Penggunas', 'pengguna@example.com', NULL, '$2y$12$jnlfZpDXFRMCG0uXvWejLOcLbyGq00FwVVuKjQGNxjxlSjadEOk3i', 'pVJIREonTN8jsnIuC2sYJZR4gZXplUqeG4aWpWrj0XcT529tsTxqJG1UA590', 2, '2024-05-23 12:39:11', '2024-05-23 14:53:32');
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `atributs`
|
||||
--
|
||||
ALTER TABLE `atributs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `atributs_slug_unique` (`slug`);
|
||||
|
||||
--
|
||||
-- Indexes for table `classifications`
|
||||
--
|
||||
ALTER TABLE `classifications`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `failed_jobs`
|
||||
--
|
||||
ALTER TABLE `failed_jobs`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
|
||||
|
||||
--
|
||||
-- Indexes for table `migrations`
|
||||
--
|
||||
ALTER TABLE `migrations`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `nilai_atributs`
|
||||
--
|
||||
ALTER TABLE `nilai_atributs`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `password_reset_tokens`
|
||||
--
|
||||
ALTER TABLE `password_reset_tokens`
|
||||
ADD PRIMARY KEY (`email`);
|
||||
|
||||
--
|
||||
-- Indexes for table `personal_access_tokens`
|
||||
--
|
||||
ALTER TABLE `personal_access_tokens`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
|
||||
ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `probabilities`
|
||||
--
|
||||
ALTER TABLE `probabilities`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
--
|
||||
-- Indexes for table `testing_data`
|
||||
--
|
||||
ALTER TABLE `testing_data`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `testing_data_rumah_foreign` (`rumah`),
|
||||
ADD KEY `testing_data_pekerjaan_foreign` (`pekerjaan`),
|
||||
ADD KEY `testing_data_listrik_foreign` (`listrik`),
|
||||
ADD KEY `testing_data_ph_foreign` (`ph`),
|
||||
ADD KEY `testing_data_suhu_foreign` (`suhu`),
|
||||
ADD KEY `testing_data_kelembapan_foreign` (`kelembapan`),
|
||||
ADD KEY `testing_data_tekstur_tanah_foreign` (`tekstur_tanah`);
|
||||
|
||||
--
|
||||
-- Indexes for table `training_data`
|
||||
--
|
||||
ALTER TABLE `training_data`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `training_data_ph_foreign` (`ph`),
|
||||
ADD KEY `training_data_suhu_foreign` (`suhu`),
|
||||
ADD KEY `training_data_kelembapan_foreign` (`kelembapan`),
|
||||
ADD KEY `training_data_tekstur_tanah_foreign` (`tekstur_tanah`);
|
||||
|
||||
--
|
||||
-- Indexes for table `users`
|
||||
--
|
||||
ALTER TABLE `users`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE KEY `users_email_unique` (`email`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `atributs`
|
||||
--
|
||||
ALTER TABLE `atributs`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `classifications`
|
||||
--
|
||||
ALTER TABLE `classifications`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `failed_jobs`
|
||||
--
|
||||
ALTER TABLE `failed_jobs`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `migrations`
|
||||
--
|
||||
ALTER TABLE `migrations`
|
||||
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `nilai_atributs`
|
||||
--
|
||||
ALTER TABLE `nilai_atributs`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `personal_access_tokens`
|
||||
--
|
||||
ALTER TABLE `personal_access_tokens`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `probabilities`
|
||||
--
|
||||
ALTER TABLE `probabilities`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `testing_data`
|
||||
--
|
||||
ALTER TABLE `testing_data`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `training_data`
|
||||
--
|
||||
ALTER TABLE `training_data`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `users`
|
||||
--
|
||||
ALTER TABLE `users`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `testing_data`
|
||||
--
|
||||
ALTER TABLE `testing_data`
|
||||
ADD CONSTRAINT `testing_data_kelembapan_foreign` FOREIGN KEY (`kelembapan`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_listrik_foreign` FOREIGN KEY (`listrik`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_pekerjaan_foreign` FOREIGN KEY (`pekerjaan`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_ph_foreign` FOREIGN KEY (`ph`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_rumah_foreign` FOREIGN KEY (`rumah`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_suhu_foreign` FOREIGN KEY (`suhu`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `testing_data_tekstur_tanah_foreign` FOREIGN KEY (`tekstur_tanah`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `training_data`
|
||||
--
|
||||
ALTER TABLE `training_data`
|
||||
ADD CONSTRAINT `training_data_kelembapan_foreign` FOREIGN KEY (`kelembapan`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `training_data_ph_foreign` FOREIGN KEY (`ph`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `training_data_suhu_foreign` FOREIGN KEY (`suhu`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `training_data_tekstur_tanah_foreign` FOREIGN KEY (`tekstur_tanah`) REFERENCES `nilai_atributs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used during authentication for various
|
||||
| messages that we need to display to the user. You are free to modify
|
||||
| these language lines according to your application's requirements.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'password' => 'The provided password is incorrect.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
|
||||
];
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used by the paginator library to build
|
||||
| the simple pagination links. You are free to change them to anything
|
||||
| you want to customize your views to better match your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'previous' => '« Previous',
|
||||
'next' => 'Next »',
|
||||
|
||||
];
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are the default lines which match reasons
|
||||
| that are given by the password broker for a password update attempt
|
||||
| has failed, such as for an invalid token or invalid new password.
|
||||
|
|
||||
*/
|
||||
|
||||
'reset' => 'Your password has been reset.',
|
||||
'sent' => 'We have emailed your password reset link.',
|
||||
'throttled' => 'Please wait before retrying.',
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'user' => "We can't find a user with that email address.",
|
||||
|
||||
];
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute field must be accepted.',
|
||||
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
|
||||
'active_url' => 'The :attribute field must be a valid URL.',
|
||||
'after' => 'The :attribute field must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute field must only contain letters.',
|
||||
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
|
||||
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
|
||||
'array' => 'The :attribute field must be an array.',
|
||||
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
|
||||
'before' => 'The :attribute field must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'array' => 'The :attribute field must have between :min and :max items.',
|
||||
'file' => 'The :attribute field must be between :min and :max kilobytes.',
|
||||
'numeric' => 'The :attribute field must be between :min and :max.',
|
||||
'string' => 'The :attribute field must be between :min and :max characters.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'can' => 'The :attribute field contains an unauthorized value.',
|
||||
'confirmed' => 'The :attribute field confirmation does not match.',
|
||||
'current_password' => 'The password is incorrect.',
|
||||
'date' => 'The :attribute field must be a valid date.',
|
||||
'date_equals' => 'The :attribute field must be a date equal to :date.',
|
||||
'date_format' => 'The :attribute field must match the format :format.',
|
||||
'decimal' => 'The :attribute field must have :decimal decimal places.',
|
||||
'declined' => 'The :attribute field must be declined.',
|
||||
'declined_if' => 'The :attribute field must be declined when :other is :value.',
|
||||
'different' => 'The :attribute field and :other must be different.',
|
||||
'digits' => 'The :attribute field must be :digits digits.',
|
||||
'digits_between' => 'The :attribute field must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute field has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
|
||||
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
|
||||
'email' => 'The :attribute field must be a valid email address.',
|
||||
'ends_with' => 'The :attribute field must end with one of the following: :values.',
|
||||
'enum' => 'The selected :attribute is invalid.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
|
||||
'file' => 'The :attribute field must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
'array' => 'The :attribute field must have more than :value items.',
|
||||
'file' => 'The :attribute field must be greater than :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be greater than :value.',
|
||||
'string' => 'The :attribute field must be greater than :value characters.',
|
||||
],
|
||||
'gte' => [
|
||||
'array' => 'The :attribute field must have :value items or more.',
|
||||
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be greater than or equal to :value.',
|
||||
'string' => 'The :attribute field must be greater than or equal to :value characters.',
|
||||
],
|
||||
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
|
||||
'image' => 'The :attribute field must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field must exist in :other.',
|
||||
'integer' => 'The :attribute field must be an integer.',
|
||||
'ip' => 'The :attribute field must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute field must be a valid JSON string.',
|
||||
'lowercase' => 'The :attribute field must be lowercase.',
|
||||
'lt' => [
|
||||
'array' => 'The :attribute field must have less than :value items.',
|
||||
'file' => 'The :attribute field must be less than :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be less than :value.',
|
||||
'string' => 'The :attribute field must be less than :value characters.',
|
||||
],
|
||||
'lte' => [
|
||||
'array' => 'The :attribute field must not have more than :value items.',
|
||||
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute field must be less than or equal to :value.',
|
||||
'string' => 'The :attribute field must be less than or equal to :value characters.',
|
||||
],
|
||||
'mac_address' => 'The :attribute field must be a valid MAC address.',
|
||||
'max' => [
|
||||
'array' => 'The :attribute field must not have more than :max items.',
|
||||
'file' => 'The :attribute field must not be greater than :max kilobytes.',
|
||||
'numeric' => 'The :attribute field must not be greater than :max.',
|
||||
'string' => 'The :attribute field must not be greater than :max characters.',
|
||||
],
|
||||
'max_digits' => 'The :attribute field must not have more than :max digits.',
|
||||
'mimes' => 'The :attribute field must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute field must be a file of type: :values.',
|
||||
'min' => [
|
||||
'array' => 'The :attribute field must have at least :min items.',
|
||||
'file' => 'The :attribute field must be at least :min kilobytes.',
|
||||
'numeric' => 'The :attribute field must be at least :min.',
|
||||
'string' => 'The :attribute field must be at least :min characters.',
|
||||
],
|
||||
'min_digits' => 'The :attribute field must have at least :min digits.',
|
||||
'missing' => 'The :attribute field must be missing.',
|
||||
'missing_if' => 'The :attribute field must be missing when :other is :value.',
|
||||
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
|
||||
'missing_with' => 'The :attribute field must be missing when :values is present.',
|
||||
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
|
||||
'multiple_of' => 'The :attribute field must be a multiple of :value.',
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_regex' => 'The :attribute field format is invalid.',
|
||||
'numeric' => 'The :attribute field must be a number.',
|
||||
'password' => [
|
||||
'letters' => 'The :attribute field must contain at least one letter.',
|
||||
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
|
||||
'numbers' => 'The :attribute field must contain at least one number.',
|
||||
'symbols' => 'The :attribute field must contain at least one symbol.',
|
||||
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
|
||||
],
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'present_if' => 'The :attribute field must be present when :other is :value.',
|
||||
'present_unless' => 'The :attribute field must be present unless :other is :value.',
|
||||
'present_with' => 'The :attribute field must be present when :values is present.',
|
||||
'present_with_all' => 'The :attribute field must be present when :values are present.',
|
||||
'prohibited' => 'The :attribute field is prohibited.',
|
||||
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||
'regex' => 'The :attribute field format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute field must match :other.',
|
||||
'size' => [
|
||||
'array' => 'The :attribute field must contain :size items.',
|
||||
'file' => 'The :attribute field must be :size kilobytes.',
|
||||
'numeric' => 'The :attribute field must be :size.',
|
||||
'string' => 'The :attribute field must be :size characters.',
|
||||
],
|
||||
'starts_with' => 'The :attribute field must start with one of the following: :values.',
|
||||
'string' => 'The :attribute field must be a string.',
|
||||
'timezone' => 'The :attribute field must be a valid timezone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'uppercase' => 'The :attribute field must be uppercase.',
|
||||
'url' => 'The :attribute field must be a valid URL.',
|
||||
'ulid' => 'The :attribute field must be a valid ULID.',
|
||||
'uuid' => 'The :attribute field must be a valid UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.6.4",
|
||||
"laravel-vite-plugin": "^1.0.0",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue