menampilkan data guru dari database 22-09
This commit is contained in:
parent
bbb88341ca
commit
8021405a87
|
@ -1,4 +1,4 @@
|
|||
APP_NAME=Laravel
|
||||
APP_NAME=spk_Al_Amien
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
|
@ -9,7 +9,7 @@ LOG_CHANNEL=stack
|
|||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_DATABASE=pkg
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
|
|
|
@ -3,14 +3,19 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\gurumodel;
|
||||
use DataTables;
|
||||
|
||||
|
||||
class MstGuruController extends Controller
|
||||
{
|
||||
function index() {
|
||||
return view('pages.mst_guru.index');
|
||||
}
|
||||
public function index() {
|
||||
$alamien = gurumodel::all();
|
||||
return view('pages.mst_guru.index', compact('alamien'));
|
||||
|
||||
|
||||
function create() {
|
||||
return view('pages.mst_guru.form');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class gurumodel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'nama', 'nipa', 'email', 'kabupaten','nohp2',
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGurumodelsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gurumodels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('gurumodels');
|
||||
}
|
||||
}
|
|
@ -24,12 +24,12 @@ class UsersSeeder extends Seeder
|
|||
[
|
||||
'name' => 'Penguji 1',
|
||||
'username' => 'penguji1',
|
||||
'password' => bcrypt('penguji1'),
|
||||
'password' => bcrypt('penguji01'),
|
||||
'roles' => 'penguji',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($users as $key => $value){
|
||||
foreach ($users as $key => $value) {
|
||||
User::create($value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,4 +220,9 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#dataTable').DataTable();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -7,13 +7,13 @@
|
|||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="card border-top-primary shadow mb-4">
|
||||
<div class="card border-top-primary shadow mb-4">
|
||||
<div class="card-body pt-3">
|
||||
<div class="mb-2">
|
||||
<a href="{{ route('create_guru') }}" class="btn btn-sm btn-primary">Tambah Guru</a>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
|
||||
<table class="table table-bordered" id="datatable" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">No</th>
|
||||
|
@ -26,23 +26,36 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach($alamien as $guru)
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Yuliana Dewi</td>
|
||||
<td>20020718 202301 2 001</td>
|
||||
<td>dewsocute@mail.com</td>
|
||||
<td>Nganjuk Pride</td>
|
||||
<td>081234567890</td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-sm btn-warning">Edit</button>
|
||||
<button class="btn btn-sm btn-danger">Hapus</button>
|
||||
<th scope="row">{{ $loop->iteration }}</th>
|
||||
<td>{{ $guru->nama }}</td>
|
||||
<td>{{ $guru->nipa }}</td>
|
||||
<td>{{ $guru->email }}</td>
|
||||
<td>{{ $guru->kabupaten }}</td>
|
||||
<td>{{ $guru->nohp1 }}</td>
|
||||
<td>
|
||||
<form class="text-center" method="post">
|
||||
<button type="submit" class="btn btn-warning">Edit</button>
|
||||
<button type="submit" class="btn btn-danger">Hapus</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable').DataTable();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
|
|
|
@ -34,6 +34,7 @@ Route::middleware(['auth'])->group(function () {
|
|||
Route::middleware('admin')->group(function () {
|
||||
Route::prefix('data-guru')->group(function () {
|
||||
Route::get('/', [MstGuruController::class, 'index'])->name('data_guru');
|
||||
Route::get('/guru', [MstGuruController::class, 'index'])->name('guru.index');
|
||||
Route::get('/tambah', [MstGuruController::class, 'create'])->name('create_guru');
|
||||
});
|
||||
Route::prefix('data-kriteria')->group(function () {
|
||||
|
|
Loading…
Reference in New Issue