WIP
This commit is contained in:
parent
c4072d9fac
commit
d582d23d29
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DataSoalController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.pages.data_soal.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HasilTesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.pages.data_hasil_kecemasan.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -17,10 +17,9 @@ public function handle(Request $request, Closure $next): Response
|
|||
{
|
||||
if(!session('is_logged_in')) {
|
||||
if(session('who_roles') == 'user') {
|
||||
return redirect()->route('dashboard.index');
|
||||
return redirect()->route('beranda.index');
|
||||
}
|
||||
|
||||
return redirect()->route('beranda.index');
|
||||
return redirect()->route('dashboard.index');
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DataSoalModel extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ public function up(): void
|
|||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('id_user')->unique();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->date('tgl_lahir')->nullable()->after('role');
|
||||
$table->string('alamat')->after('tgl_lahir');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('tgl_lahir');
|
||||
$table->dropColumn('alamat');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -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('test', function (Blueprint $table) {
|
||||
$table->uuid('id_test')->primary();
|
||||
$table->uuid('id_user');
|
||||
$table->timestamps();
|
||||
|
||||
// Foreign Key
|
||||
$table->foreign('id_user')->references('id_user')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('test');
|
||||
}
|
||||
};
|
||||
|
|
@ -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('detail_test', function (Blueprint $table) {
|
||||
$table->uuid('id_detail_test')->primary();
|
||||
$table->uuid('id_soal');
|
||||
$table->uuid('id_test');
|
||||
$table->enum('jawaban', ['a', 'b', 'c', 'd', 'e', 'null']);
|
||||
$table->timestamps();
|
||||
|
||||
// Foreign Key
|
||||
$table->foreign('id_test')->references('id_test')->on('test')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('detail_test');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('soal', function (Blueprint $table) {
|
||||
$table->uuid('id_soal')->primary();
|
||||
$table->string('pertanyaan');
|
||||
$table->string('jawaban_a');
|
||||
$table->string('jawaban_b');
|
||||
$table->string('jawaban_c');
|
||||
$table->string('jawaban_d');
|
||||
$table->string('jawaban_e');
|
||||
$table->enum('jawaban_benar', ['a', 'b', 'c', 'd', 'e']);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('soal');
|
||||
}
|
||||
};
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
|
|
@ -18,24 +19,30 @@ public function run(): void
|
|||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
'id_user' => Str::uuid(),
|
||||
'name' => 'Test Admin',
|
||||
'email' => 'admin@gmail.com',
|
||||
'password' => password_hash('admin1234', PASSWORD_BCRYPT, ['cost' => 12]),
|
||||
'role' => 'admin',
|
||||
'alamat' => 'Jember'
|
||||
]);
|
||||
|
||||
User::factory()->create([
|
||||
'id_user' => Str::uuid(),
|
||||
'name' => 'Test Psikolog',
|
||||
'email' => 'psikolog@gmail.com',
|
||||
'password' => password_hash('psikolog1234', PASSWORD_BCRYPT, ['cost' => 12]),
|
||||
'role' => 'psikolog',
|
||||
'alamat' => 'Jember'
|
||||
]);
|
||||
|
||||
User::factory()->create([
|
||||
'id_user' => Str::uuid(),
|
||||
'name' => 'Test User',
|
||||
'email' => 'user@gmail.com',
|
||||
'password' => password_hash('user1234', PASSWORD_BCRYPT, ['cost' => 12]),
|
||||
'role' => 'user',
|
||||
'alamat' => 'Jember'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@
|
|||
|
||||
@if(Auth::user()->role == 'psikolog')
|
||||
<li class="pc-item">
|
||||
<a href="" class="pc-link">
|
||||
<a href="{{ route('soal.index') }}" class="pc-link">
|
||||
<span class="pc-micon"><i class="ti ti-credit-card"></i></span>
|
||||
<span class="pc-mtext">Data Soal</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="pc-item">
|
||||
<a href="" class="pc-link">
|
||||
<a href="{{ route('hasil_tes.index') }}" class="pc-link">
|
||||
<span class="pc-micon"><i class="ti ti-chart-pie"></i></span>
|
||||
<span class="pc-mtext">Data Hasil Kecemasan</span>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
<div class="row align-items-center">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header-title">
|
||||
<h5 class="m-b-10">Sample Page</h5>
|
||||
<h5 class="m-b-10">Data Soal</h5>
|
||||
</div>
|
||||
<ul class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="../dashboard/index.html">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0)">Other</a></li>
|
||||
<li class="breadcrumb-item" aria-current="page">Sample Page</li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0)">Data Master</a></li>
|
||||
<li class="breadcrumb-item" aria-current="page">Halaman Data Hasil Tes</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -25,9 +25,47 @@
|
|||
<div class="col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5>Hello card</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h5>Hasil Tes User</h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-sm btn-primary rounded-circle">
|
||||
<i class="ti ti-database-import"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table" id="table-data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Dummy</th>
|
||||
<th>Dummy</th>
|
||||
<th>Dummy</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>lorem</td>
|
||||
<td>lorem</td>
|
||||
<td>lorem</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-info btn-sm rounded-circle mx-1" data-bs-toggle="modal" data-bs-target="#editModal" onclick="getDataEdit(this)" data-id="${data.id}">
|
||||
<i class="ti ti-edit"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger delete-btn rounded-circle mx-1" data-bs-toggle="modal" data-bs-target="#deleteModal" onclick="getDataHapus(this)" data-id="${data.id}">
|
||||
<i class="ti ti-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -38,6 +76,6 @@
|
|||
|
||||
@section('script')
|
||||
<script>
|
||||
|
||||
new DataTable("#table-data", {});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -6,12 +6,12 @@
|
|||
<div class="row align-items-center">
|
||||
<div class="col-md-12">
|
||||
<div class="page-header-title">
|
||||
<h5 class="m-b-10">Sample Page</h5>
|
||||
<h5 class="m-b-10">Data Soal</h5>
|
||||
</div>
|
||||
<ul class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="../dashboard/index.html">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0)">Other</a></li>
|
||||
<li class="breadcrumb-item" aria-current="page">Sample Page</li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Home</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0)">Data Master</a></li>
|
||||
<li class="breadcrumb-item" aria-current="page">Halaman Data Soal</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -25,9 +25,47 @@
|
|||
<div class="col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5>Hello card</h5>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h5>Kumpulan Soal</h5>
|
||||
</div>
|
||||
<div class="col-md-6 d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-sm btn-primary rounded-circle">
|
||||
<i class="ti ti-database-import"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table" id="table-data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Dummy</th>
|
||||
<th>Dummy</th>
|
||||
<th>Dummy</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>lorem</td>
|
||||
<td>lorem</td>
|
||||
<td>lorem</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-info btn-sm rounded-circle mx-1" data-bs-toggle="modal" data-bs-target="#editModal" onclick="getDataEdit(this)" data-id="${data.id}">
|
||||
<i class="ti ti-edit"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger delete-btn rounded-circle mx-1" data-bs-toggle="modal" data-bs-target="#deleteModal" onclick="getDataHapus(this)" data-id="${data.id}">
|
||||
<i class="ti ti-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -38,6 +76,6 @@
|
|||
|
||||
@section('script')
|
||||
<script>
|
||||
|
||||
new DataTable("#table-data", {});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\DataSoalController;
|
||||
use App\Http\Controllers\HasilTesController;
|
||||
use App\Http\Controllers\LandingController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\UsersController;
|
||||
|
|
@ -25,6 +27,8 @@
|
|||
Route::resource('dashboard', DashboardController::class);
|
||||
Route::resource('users', UsersController::class);
|
||||
Route::get('users/fetch/data', [UsersController::class, 'getData'])->name('users.fetchData');
|
||||
Route::resource('soal', DataSoalController::class);
|
||||
Route::resource('hasil_tes', HasilTesController::class);
|
||||
});
|
||||
|
||||
require __DIR__.'/auth.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue