fixing banyak

This commit is contained in:
FahrezaDaffa93 2024-02-17 20:12:46 +07:00
parent d3a166b60e
commit d29c283a50
16 changed files with 315 additions and 49 deletions

View File

@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Aturan;
use App\Models\Gejala;
use App\Models\Penyakit;
class AturanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$aturan = Aturan::all();
$Gejala = Gejala::all();
$Penyakit = Penyakit::all();
$gejalas = Gejala::orderBy('id_gejala')->get();
return view("aturan.aturan", compact('aturan','gejalas'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Gejala;
class GejalaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$gejala=Gejala::all();
return view("gejala",compact("gejala"));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Penyakit;
class PenyakitController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$penyakit = Penyakit::all();
return view("penyakit.penyakit", compact("penyakit"));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -1,5 +1,4 @@
<?php <?php
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -8,4 +7,18 @@
class Aturan extends Model class Aturan extends Model
{ {
use HasFactory; use HasFactory;
protected $table = 'aturan';
// Relasi ke model Gejala
public function gejala()
{
return $this->belongsTo(Gejala::class, 'id_gejala');
}
// Relasi ke model Penyakit
public function penyakit()
{
return $this->belongsTo(Penyakit::class, 'id_penyakit');
}
} }

View File

@ -8,4 +8,6 @@
class Gejala extends Model class Gejala extends Model
{ {
use HasFactory; use HasFactory;
protected $table='gejala';
protected $primaryKey='id_gejala';
} }

View File

@ -8,4 +8,6 @@
class Penyakit extends Model class Penyakit extends Model
{ {
use HasFactory; use HasFactory;
protected $table="penyakit";
protected $primaryKey="id_penyakit";
} }

View File

@ -1,5 +1,4 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
@ -12,10 +11,11 @@
public function up(): void public function up(): void
{ {
Schema::create('gejala', function (Blueprint $table) { Schema::create('gejala', function (Blueprint $table) {
$table->increments('id_gejala'); $table->id('id_gejala');
$table->string('kode_gejala'); $table->string('kode_gejala');
$table->string('gejala'); $table->string('gejala');
$table->timestamps();
}); });
} }
@ -24,6 +24,6 @@ public function up(): void
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('gejalas'); Schema::dropIfExists('gejala'); // Menghapus tabel gejala
} }
}; };

View File

@ -13,8 +13,15 @@ public function up(): void
{ {
Schema::create('aturan', function (Blueprint $table) { Schema::create('aturan', function (Blueprint $table) {
$table->id('id_aturan'); $table->id('id_aturan');
$table->unsignedBigInteger('id_gejala');
$table->unsignedBigInteger('id_penyakit');
$table->float('belief');
$table->foreign('id_gejala')->references('id_gejala')->on('gejala')->onDelete('cascade');
$table->foreign('id_penyakit')->references('id_penyakit')->on('penyakit')->onDelete('cascade');
}); });
} }
/** /**

View File

@ -1,6 +0,0 @@
@extends('layouts.master')
@section('title', 'aturan')
@section('konten')
@endsection

View File

@ -0,0 +1,43 @@
@extends('layouts.master')
@section('title', 'aturan')
@section('konten')
<table class="table table-striped" id="table-1">
<thead>
<tr>
<th class="text-center">No</th>
<th>Kode Gejala</th>
<th>Gejala</th>
<th>Penyakit</th>
<th>Nilai Kepercayaan</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<!-- footer content -->
</tfoot>
<tbody>
@php
$gejalaGroups = $aturan->groupBy('gejala_id');
@endphp
@foreach ($gejalaGroups as $gejalaId => $group)
<tr>
<td class="text-center">{{ $loop->iteration }}</td>
<td>{{ optional($group->first()->gejala)->kode_gejala}}</td>
<td>{{ optional($group->first()->gejala)->gejala}}</td>
<td>
@foreach ($group as $data)
{{ $data->penyakit->nama_penyakit }} ({{ $data->penyakit->kode_penyakit }}) <br>
@endforeach
</td>
<td>{{ $group->first()->belief }}</td>
<td>
<a href="#" class="edit-button" data-bs-toggle="modal" data-bs-target="#edit-user" data-id_user="{{ $group->first()->id_user }}" data-name="{{ $group->first()->name }}" data-email="{{ $group->first()->email }}" data-area="{{ $group->first()->area }}" data-no_hp="{{ $group->first()->no_hp }}" data-kelas="{{ $group->first()->kelas }}">
<i class="fas fa-edit"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection

View File

@ -2,24 +2,16 @@
@section('title', 'gejala') @section('title', 'gejala')
@section('konten') @section('konten')
<div class="container"> <div class="container">
<h1 id="h1Gejala"> Gejala Penyakit Mulut dan Kuku Pada Sapi </h1> <h1 id="h1Gejala"> Gejala Penyakit Mulut dan Kuku Pada Sapi </h1>
<img src="img/gejala/gejalaPMK.png" alt="" id="gambarGejala"> <img src="img/gejala/gejalaPMK.png" alt="" id="gambarGejala">
</div> </div>
<div id="listGejala"> <div id="listGejala">
{{-- <h1>Gejala PMK </h1> --}}
<ol> <ol>
<li>Terdapat ulcer atau luka di lidah, bibir, mulut, dan kuku kaki.</li> @foreach ($gejala as $gejalaItem)
<li>Sapi mengalami demam dan lesu.</li> <li>{{ $gejalaItem ->gejala}} {{"{".$gejalaItem ->kode_gejala."}" }}</li>
<li>Sapi mengalami kehilangan nafsu makan</li>
<li> Produksi susu sapi menurun</li> @endforeach
<li>Sapi mengalami kesulitan bergerak atau berjalan karena rasa sakit yang dialami.</li>
<li>Kuku kaki mengalami pembengkakan dan kerusakan.</li>
<li>keluar air liur yang berlebihan</li>
<li> Ambruk atau tidak dapat berdiri</li>
<li> Kondisi fisik yang kurus atau menurun.</li>
<li>Terjadi tanda-tanda pernapasan yang abnormal, seperti kesulitan bernapas dan batuk.</li>
<li>Luka atau bisul pada kuku atau jari kaki.</li>
<li>Terlihat cairan atau nanah keluar dari kuku atau jari kaki.</li>
</ol> </ol>
<input type="submit" id="btn-tambahGejala" value="Tambah Gejala">
</div> </div>
@endsection @endsection

View File

@ -49,16 +49,11 @@
<li class="nav-item mx-2"> <li class="nav-item mx-2">
<a class="nav-link @if(request()->is('gejala')) active @endif" href="/gejala">Gejala</a> <a class="nav-link @if(request()->is('gejala')) active @endif" href="/gejala">Gejala</a>
</li> </li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <li class="nav-item mx-2">
Kategori <a class="nav-link @if(request()->is('aturan')) active @endif" href="/aturan">Aturan</a>
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Kategori 1</a></li>
<li><a class="dropdown-item" href="#">Kategori 2</a></li>
<li><a class="dropdown-item" href="#">Kategori 3</a></li>
</ul>
</li> </li>
</ul> </ul>
<div class="ml-2"> <div class="ml-2">
<a href="#" id="loginNav" class="btn btn-outline-success mr-3 mx-2">Login</a> <a href="#" id="loginNav" class="btn btn-outline-success mr-3 mx-2">Login</a>

View File

@ -1,6 +0,0 @@
@extends('layouts.master')
@section('title', 'penyakit')
@section('konten')
@endsection

View File

@ -0,0 +1,20 @@
@extends('layouts.master')
@section('title', 'penyakit')
@section('konten')
<div class="container">
<h1 id="h1Gejala"> Penyakit Mulut dan Kuku Pada Sapi </h1>
<img src="img/gejala/gejalaPMK.png" alt="" id="gambarGejala">
</div>
<div id="listGejala">
<ol>
@foreach ($penyakit as $penyakitItem)
<li>{{ $penyakitItem ->nama_penyakit}} </br>{{ $penyakitItem ->deskripsi_penyakit}} </li>
@endforeach
</ol>
</div>
@endsection

View File

@ -1,8 +1,11 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\GejalaController;
use App\Http\Controllers\PenyakitController;
use App\Http\Controllers\AturanController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -22,14 +25,14 @@
return view('gejala'); return view('gejala');
}); });
Route::get('/aturan', function () { Route::get('/gejala', [GejalaController::class, 'index']);
return view('aturan');
});
Route::get('/penyakit', function () {
return view('penyakit'); Route::get('/penyakit', [PenyakitController::class, 'index']);
});
Route::get('/konsultasi', function () { Route::get('/konsultasi', function () {
return view('konsultasi'); return view('konsultasi');
}); });
//Aturan
Route::get('/aturan', [AturanController::class, 'index']);