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_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
|
@ -9,7 +9,7 @@ LOG_CHANNEL=stack
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=laravel
|
DB_DATABASE=pkg
|
||||||
DB_USERNAME=root
|
DB_USERNAME=root
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,19 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\gurumodel;
|
||||||
|
use DataTables;
|
||||||
|
|
||||||
|
|
||||||
class MstGuruController extends Controller
|
class MstGuruController extends Controller
|
||||||
{
|
{
|
||||||
function index() {
|
public function index() {
|
||||||
return view('pages.mst_guru.index');
|
$alamien = gurumodel::all();
|
||||||
}
|
return view('pages.mst_guru.index', compact('alamien'));
|
||||||
|
|
||||||
|
|
||||||
function create() {
|
function create() {
|
||||||
return view('pages.mst_guru.form');
|
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',
|
'name' => 'Penguji 1',
|
||||||
'username' => 'penguji1',
|
'username' => 'penguji1',
|
||||||
'password' => bcrypt('penguji1'),
|
'password' => bcrypt('penguji01'),
|
||||||
'roles' => 'penguji',
|
'roles' => 'penguji',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($users as $key => $value){
|
foreach ($users as $key => $value) {
|
||||||
User::create($value);
|
User::create($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,4 +220,9 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#dataTable').DataTable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
|
@ -7,42 +7,55 @@
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@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="card-body pt-3">
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<a href="{{ route('create_guru') }}" class="btn btn-sm btn-primary">Tambah Guru</a>
|
<a href="{{ route('create_guru') }}" class="btn btn-sm btn-primary">Tambah Guru</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<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>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="5%">No</th>
|
||||||
|
<th>Nama</th>
|
||||||
|
<th>NIP</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Address</th>
|
||||||
|
<th>Phone</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
@foreach($alamien as $guru)
|
||||||
<tr>
|
<tr>
|
||||||
<th width="5%">No</th>
|
<th scope="row">{{ $loop->iteration }}</th>
|
||||||
<th>Nama</th>
|
<td>{{ $guru->nama }}</td>
|
||||||
<th>NIP</th>
|
<td>{{ $guru->nipa }}</td>
|
||||||
<th>Email</th>
|
<td>{{ $guru->email }}</td>
|
||||||
<th>Address</th>
|
<td>{{ $guru->kabupaten }}</td>
|
||||||
<th>Phone</th>
|
<td>{{ $guru->nohp1 }}</td>
|
||||||
<th class="text-center">Action</th>
|
<td>
|
||||||
</tr>
|
<form class="text-center" method="post">
|
||||||
</thead>
|
<button type="submit" class="btn btn-warning">Edit</button>
|
||||||
<tbody>
|
<button type="submit" class="btn btn-danger">Hapus</button>
|
||||||
<tr>
|
</form>
|
||||||
<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>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
@endforeach
|
||||||
</table>
|
</tbody>
|
||||||
</div>
|
</table>
|
||||||
</div>
|
</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
|
@endsection
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
|
|
@ -34,6 +34,7 @@ Route::middleware(['auth'])->group(function () {
|
||||||
Route::middleware('admin')->group(function () {
|
Route::middleware('admin')->group(function () {
|
||||||
Route::prefix('data-guru')->group(function () {
|
Route::prefix('data-guru')->group(function () {
|
||||||
Route::get('/', [MstGuruController::class, 'index'])->name('data_guru');
|
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::get('/tambah', [MstGuruController::class, 'create'])->name('create_guru');
|
||||||
});
|
});
|
||||||
Route::prefix('data-kriteria')->group(function () {
|
Route::prefix('data-kriteria')->group(function () {
|
||||||
|
|
Loading…
Reference in New Issue