Browse Source

update DB Sql Server

master
Gunawan19621 1 year ago
parent
commit
1b9bba0be4
  1. 115
      app/Http/Controllers/M_assetController.php
  2. 46
      app/Http/Controllers/RoleController.php
  3. 2
      app/Http/Controllers/WarehouseController.php
  4. 1
      app/Models/BarangMasuk.php
  5. 2
      app/Models/m_role.php
  6. 2
      config/database.php
  7. 11
      database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php
  8. 55
      database/migrations/2023_09_20_163617_create_users_table.php
  9. 9
      database/migrations/2023_10_23_073314_create_m_warehouses_table.php
  10. 19
      database/migrations/2023_10_23_074754_create_m_assets_table.php
  11. 14
      database/migrations/2023_10_23_075239_create_m_roles_table.php
  12. 49
      database/migrations/2023_10_23_075245_create_users_table.php
  13. 16
      database/migrations/2023_10_23_120702_create_barang_masuks_table.php
  14. 12
      database/migrations/2023_10_23_120927_create_barang_keluars_table.php
  15. 16
      database/migrations/2023_10_23_122033_create_asset_statuses_table.php
  16. 7
      database/seeders/DatabaseSeeder.php
  17. 32
      database/seeders/RoleSeeder.php
  18. 57
      database/seeders/UserSeeder.php
  19. 34
      database/seeders/WarehouseSeeder.php
  20. 11
      resources/views/MasterData/asset.blade.php
  21. 11
      resources/views/MasterData/role/create.blade.php
  22. 32
      resources/views/MasterData/role/edit.blade.php
  23. 128
      resources/views/MasterData/role/index.blade.php
  24. 11
      resources/views/MasterData/role/show.blade.php
  25. 8
      resources/views/MasterData/user.blade.php
  26. 2
      resources/views/layouts/link.blade.php
  27. 2
      resources/views/layouts/sidebar.blade.php
  28. 23
      routes/web.php

115
app/Http/Controllers/M_assetController.php

@ -37,121 +37,6 @@ class M_assetController extends Controller
/**
* Store a newly created resource in storage.
*/
// public function store(Request $request)
// {
// $latestAsset = \App\Models\m_asset::latest()->first();
// // Mendapatkan tahun saat ini
// $currentYear = date("Y");
// // Menghitung nomor urut untuk kode barang
// if ($latestAsset == null) {
// // Kode pertama
// $nomorUrut = 1;
// } else {
// // Kode berikutnya
// $lastCode = substr($latestAsset->seri, 7);
// $nomorUrut = intval($lastCode) + 1;
// }
// // Menggabungkan semua komponen kode barang
// $seri = 'AST' . $currentYear . str_pad($nomorUrut, STR_PAD_LEFT);
// // Validasi input
// $request->validate([
// 'name' => 'required',
// 'description' => 'required',
// 'warehouse_id' => 'required',
// 'date' => 'required',
// 'qr_count' => '',
// ]);
// try {
// $currentUser = Auth::user();
// // Menyiapkan data untuk disimpan
// $validatedData = $request->except('_token');
// $validatedData['seri'] = $seri;
// $validatedData['created_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai created_by
// $validatedData['updated_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai updated_by
// // Menyimpan data ke dalam database
// $newAsset = \App\Models\m_asset::create($validatedData);
// // Membuat QR code dan menyimpannya ke dalam basis data
// $dataForQR = [
// 'seri' => $newAsset->seri,
// 'name' => $newAsset->name,
// // ... tambahkan lebih banyak data sesuai kebutuhan ...
// ];
// $qrCode = QrCode::size(300)->generate(json_encode($dataForQR));
// // Menyimpan QR code ke dalam kolom 'qr_code' di tabel asset (perbaikan)
// $newAsset->update(['qr_count' => $qrCode]);
// return redirect()->back()->with('success', 'Data asset berhasil ditambah.');
// } catch (\Throwable $th) {
// return redirect()->back()->with('error', 'Data asset gagal ditambah.');
// }
// }
// public function store(Request $request)
// {
// $latestAsset = \App\Models\m_asset::latest()->first();
// // Mendapatkan tahun saat ini
// $currentYear = date("Y");
// // Menghitung nomor urut untuk kode barang
// if ($latestAsset == null) {
// // Kode pertama
// $nomorUrut = 1;
// } else {
// // Kode berikutnya
// $lastCode = substr($latestAsset->seri, 7);
// $nomorUrut = intval($lastCode) + 1;
// }
// // Menggabungkan semua komponen kode barang
// $seri = 'AST' . $currentYear . str_pad($nomorUrut, STR_PAD_LEFT);
// // Validasi input
// $request->validate([
// 'name' => 'required',
// 'description' => 'required',
// 'warehouse_id' => 'required',
// 'date' => 'required',
// 'qr_count' => '',
// ]);
// try {
// $currentUser = Auth::user();
// // Menyiapkan data untuk disimpan
// $validatedData = $request->except('_token');
// $validatedData['seri'] = $seri;
// $validatedData['created_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai created_by
// $validatedData['updated_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai updated_by
// // Menyimpan data ke dalam database
// $newAsset = \App\Models\m_asset::create($validatedData);
// // Generate QR code and save it as an image in the public directory
// $dataForQR = [
// 'seri' => $newAsset->seri,
// 'name' => $newAsset->name,
// // ... tambahkan lebih banyak data sesuai kebutuhan ...
// ];
// $qrCode = QrCode::format('png')->size(300)->generate(json_encode($dataForQR));
// // Menyimpan QR code sebagai gambar di direktori penyimpanan publik
// $qrCodePath = 'qr_codes/' . $seri . '.png';
// Storage::disk('public')->put($qrCodePath, $qrCode);
// // Menyimpan URL gambar QR code ke dalam kolom 'qr_count'
// $newAsset->update(['qr_count' => $qrCodePath]);
// return redirect()->back()->with('success', 'Data asset berhasil ditambah.');
// } catch (\Throwable $th) {
// return redirect()->back()->with('error', 'Data asset gagal ditambah.');
// }
// }
public function store(Request $request)
{
// dd($request);

46
app/Http/Controllers/RoleController.php

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\m_role;
use Illuminate\Http\Request;
class RoleController extends Controller
@ -11,39 +12,53 @@ class RoleController extends Controller
*/
public function index()
{
// dd('oke');
$role = m_role::all();
return view('MasterData.role.index', compact('role'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
// public function create()
// {
// return view('MasterData.role.create');
// }
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd('oke');
$request->validate([
'name' => 'required',
'description' => 'required',
]);
try {
$validatedData = $request->except('_token');
m_role::create($validatedData);
return redirect()->back()->with('success', 'Data role Berhasil Ditambah.');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data role Gagal Ditambah.');
}
}
/**
* Display the specified resource.
*/
public function show($id)
{
// dd('oke');
}
// public function show($id)
// {
// // dd('oke');
// return view('MasterData.role.show');
// }
/**
* Show the form for editing the specified resource.
*/
public function edit()
public function edit($id)
{
// dd('oke');
$role = m_role::find($id);
return view('MasterData.role.edit', compact('role'));
}
/**
@ -51,7 +66,7 @@ class RoleController extends Controller
*/
public function update(Request $request, $id)
{
// dd('oke');
dd('oke');
}
/**
@ -60,5 +75,12 @@ class RoleController extends Controller
public function destroy($id)
{
// dd("oke");
try {
$role = m_role::findOrFail($id);
$role->delete();
return redirect()->back()->with('success', 'Data role berhasil dihapus');
} catch (\Throwable $th) {
return redirect()->back()->with('error', 'Data role gagal dihapus');
}
}
}

2
app/Http/Controllers/WarehouseController.php

@ -29,8 +29,6 @@ class WarehouseController extends Controller
*/
public function store(Request $request)
{
// dd('oke');
// dd($request);
$request->validate([
'name' => 'required',
'description' => 'required',

1
app/Models/BarangMasuk.php

@ -8,4 +8,5 @@ use Illuminate\Database\Eloquent\Model;
class BarangMasuk extends Model
{
use HasFactory;
protected $table = 'barang_masuks', $guarded = ['id'];
}

2
app/Models/m_role.php

@ -8,5 +8,5 @@ use Illuminate\Database\Eloquent\Model;
class m_role extends Model
{
use HasFactory;
protected $table = 'm_role', $guarded = ['id'];
protected $table = 'm_roles', $guarded = ['id'];
}

2
config/database.php

@ -82,7 +82,7 @@ return [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
//'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),

11
database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php

@ -13,12 +13,13 @@ return new class extends Migration
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->string('tokenable_type', 255)->nullable();
$table->bigInteger('tokenable_id')->nullable();
$table->string('name', 255)->nullable();
$table->string('token', 64)->nullable();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->dateTime('last_used_at')->nullable();
$table->dateTime('expires_at')->nullable();
$table->timestamps();
});
}

55
database/migrations/2023_09_20_163617_create_users_table.php

@ -1,55 +0,0 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username', 50);
$table->string('fullname');
$table->string('nip', 20)->nullable();
$table->string('email')->unique();
$table->string('no_hp', 20)->nullable();
$table->string('divisi', 255);
$table->date('tgl_lahir')->nullable();
$table->enum('jenis_kelamin', ['L', 'P'])->nullable();
$table->enum('agama', ['Islam', 'Kristen', 'Katolik', 'Hindu', 'Budha', 'Konghucu'])->nullable();
$table->string('foto', 255)->nullable();
$table->bigInteger('role_id')->unsigned();
$table->foreign('role_id')->references('id')->on('m_roles');
$table->bigInteger('warehouse_id')->unsigned();
$table->foreign('warehouse_id')->references('id')->on('m_warehouses');
$table->text('address')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
$table->softDeletes(); // Menambahkan kolom deleted_at untuk soft delete
});
DB::table('users')->insert([
['username' => 'Gunawan19621', 'fullname' => 'Gunawan', 'nip' => '111111', 'email' => 'gunawan19621@gmail.com', 'no_hp' => '085159079010', 'divisi' => 'admin', 'role_id' => 1, 'warehouse_id' => 1, 'address' => 'Jl. Raya Gelarmendala', 'password' => bcrypt('19062001')],
['username' => 'warehouse123', 'fullname' => 'warehouse', 'nip' => '222222', 'email' => 'warehouse@gmail.com', 'no_hp' => '085159079020', 'divisi' => 'admin', 'role_id' => 2, 'warehouse_id' => 2, 'address' => 'Jl. Raya Ciwatu', 'password' => bcrypt('warehouse123')],
['username' => 'customer123', 'fullname' => 'customer', 'nip' => '333333', 'email' => 'customer@gmail.com', 'no_hp' => '085159079030', 'divisi' => 'admin', 'role_id' => 3, 'warehouse_id' => 3, 'address' => 'Jl. Raya Balongan', 'password' => bcrypt('customer123')]
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

9
database/migrations/2023_09_20_163615_create_m_warehouses_table.php → database/migrations/2023_10_23_073314_create_m_warehouses_table.php

@ -3,7 +3,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
@ -14,7 +13,7 @@ return new class extends Migration
{
Schema::create('m_warehouses', function (Blueprint $table) {
$table->id();
$table->string('name', 200);
$table->string('name', 200)->nullable();
$table->text('description')->nullable();
$table->text('address')->nullable();
$table->timestamps();
@ -22,12 +21,6 @@ return new class extends Migration
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
});
DB::table('m_warehouses')->insert([
['name' => 'Gudangsatu', 'description' => 'Gudang Barang', 'address' => 'Jln. Raya Kesatu'],
['name' => 'Gudangdua', 'description' => 'Gudang Makanan', 'address' => 'Jln. Raya Kedua'],
['name' => 'Gudangtiga', 'description' => 'Gudang Pakaian', 'address' => 'Jln. Raya Ketiga'],
]);
}
/**

19
database/migrations/2023_09_20_163618_create_m_assets_table.php → database/migrations/2023_10_23_074754_create_m_assets_table.php

@ -13,18 +13,17 @@ return new class extends Migration
{
Schema::create('m_assets', function (Blueprint $table) {
$table->id();
$table->string('seri', 50);
$table->string('name', 200);
$table->text('description');
$table->bigInteger('warehouse_id')->unsigned();
$table->foreign('warehouse_id')->references('id')->on('m_warehouses');
$table->datetime('date');
// $table->integer('qr_count');
$table->string('qr_count')->nullable();
$table->string('seri', 50)->nullable();
$table->string('name', 200)->nullable();
$table->text('description')->nullable();
$table->unsignedBigInteger('warehouse_id')->nullable();
$table->foreign('warehouse_id')->references('id')->on('m_warehouses')->onDelete('set null');
$table->datetime('date')->nullable();
$table->string('qr_count', 255)->nullable();
$table->timestamps();
$table->softDeletes();
$table->string('created_by', 200);
$table->string('updated_by', 200);
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
});
}

14
database/migrations/2023_09_20_163553_create_m_roles_table.php → database/migrations/2023_10_23_075239_create_m_roles_table.php

@ -3,7 +3,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
@ -14,20 +13,13 @@ return new class extends Migration
{
Schema::create('m_roles', function (Blueprint $table) {
$table->id();
$table->string('name', 200);
$table->string('name', 200)->nullable();
$table->text('description')->nullable();
$table->timestamps();
$table->softDeletes();
$table->string('created_by', 200)->nullable()->default('System');
$table->string('updated_by', 200)->nullable()->default('System');
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
});
// Insert default roles
DB::table('m_roles')->insert([
['name' => 'admin', 'description' => 'Administrator'],
['name' => 'warehouse', 'description' => 'Warehouse User'],
['name' => 'customer', 'description' => 'Customer'],
]);
}
/**

49
database/migrations/2023_10_23_075245_create_users_table.php

@ -0,0 +1,49 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('username', 50)->nullable();
$table->string('fullname', 255)->nullable();
$table->string('nip', 20)->nullable();
$table->string('email', 255)->nullable();
$table->string('no_hp', 20)->nullable();
$table->string('divisi', 255)->nullable();
$table->date('tgl_lahir')->nullable();
$table->string('jenis_kelamin', 30)->nullable();
$table->string('agama', 30)->nullable();
$table->string('foto', 255)->nullable();
$table->bigInteger('role_id')->unsigned()->nullable();
$table->foreign('role_id')->references('id')->on('m_roles')->onDelete('set null');
$table->bigInteger('warehouse_id')->unsigned()->nullable();
$table->foreign('warehouse_id')->references('id')->on('m_warehouses')->onDelete('set null');
$table->text('address')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password', 255)->nullable();
$table->rememberToken();
$table->timestamps();
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

16
database/migrations/2023_10_03_122058_create_barang_masuks_table.php → database/migrations/2023_10_23_120702_create_barang_masuks_table.php

@ -13,15 +13,15 @@ return new class extends Migration
{
Schema::create('barang_masuks', function (Blueprint $table) {
$table->id();
$table->bigInteger('asset_id')->unsigned();
$table->foreign('asset_id')->references('id')->on('m_assets');
$table->integer('jumlah'); // Kolom untuk jumlah barang masuk
$table->date('tanggal_masuk'); // Kolom untuk tanggal barang masuk
$table->string('asal_barang', 200); // Kolom untuk PIC barang masuk
$table->string('pengirim_barang', 200); // Kolom untuk PIC barang masuk
$table->string('penerima_barang', 200); // Kolom untuk PIC barang masuk
$table->bigInteger('asset_id')->unsigned()->nullable();
$table->foreign('asset_id')->references('id')->on('m_assets')->onDelete('set null');
$table->integer('jumlah')->nullable();
$table->date('tanggal_masuk')->nullable();
$table->string('asal_barang', 200)->nullable();
$table->string('pengiriman_barang', 200)->nullable();
$table->string('penerima_barang', 200)->nullable();
$table->string('enter_warehouse', 200)->nullable();
$table->string('keterangan')->nullable(); // Kolom untuk keterangan (opsional)
$table->string('keterangan', 255)->nullable();
$table->timestamps();
});
}

12
database/migrations/2023_10_03_134950_create_barang_keluars_table.php → database/migrations/2023_10_23_120927_create_barang_keluars_table.php

@ -13,13 +13,13 @@ return new class extends Migration
{
Schema::create('barang_keluars', function (Blueprint $table) {
$table->id();
$table->bigInteger('asset_id')->unsigned();
$table->foreign('asset_id')->references('id')->on('m_assets');
$table->integer('jumlah'); // Kolom untuk jumlah barang masuk
$table->date('tanggal_keluar'); // Kolom untuk tanggal barang masuk
$table->string('penerima_barang', 200); // Kolom untuk PIC barang masuk
$table->bigInteger('assets_id')->unsigned()->nullable();
$table->foreign('assets_id')->references('id')->on('m_assets')->onDelete('set null');
$table->integer('jumlah')->nullable();
$table->date('tanggal_keluar')->nullable();
$table->string('penerima_barang', 200)->nullable();
$table->string('exit_warehouse', 200)->nullable();
$table->string('keterangan')->nullable(); // Kolom untuk keterangan (opsional)
$table->string('keterangan', 255)->nullable();
$table->timestamps();
});
}

16
database/migrations/2023_09_20_163641_create_asset_statuses_table.php → database/migrations/2023_10_23_122033_create_asset_statuses_table.php

@ -13,22 +13,18 @@ return new class extends Migration
{
Schema::create('asset_statuses', function (Blueprint $table) {
$table->id();
$table->bigInteger('asset_id')->unsigned();
$table->foreign('asset_id')->references('id')->on('m_assets')->onDelete('cascade');
$table->datetime('exit_at');
$table->string('exit_pic', 200);
// $table->string('exit_warehouse', 200);
$table->bigInteger('asset_id')->unsigned()->nullable();
$table->foreign('asset_id')->references('id')->on('m_assets')->onDelete('set null');
$table->datetime('exit_at')->nullable();
$table->string('exit_pic', 200)->nullable();
$table->bigInteger('exit_warehouse')->unsigned()->nullable();
$table->foreign('exit_warehouse')->references('id')->on('m_warehouses')->onDelete('cascade');
$table->datetime('enter_at')->nullable();
$table->string('enter_pic', 200)->nullable();
// $table->string('enter_warehouse', 200)->nullable();
$table->bigInteger('enter_warehouse')->unsigned()->nullable();
$table->foreign('enter_warehouse')->references('id')->on('m_warehouses')->onDelete('cascade');
$table->timestamps();
$table->softDeletes();
$table->string('created_by', 200);
$table->string('updated_by', 200);
$table->string('created_by', 200)->nullable();
$table->string('updated_by', 200)->nullable();
});
}

7
database/seeders/DatabaseSeeder.php

@ -3,6 +3,7 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\User;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
@ -18,5 +19,11 @@ class DatabaseSeeder extends Seeder
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
$this->call([
RoleSeeder::class,
WarehouseSeeder::class,
UserSeeder::class,
]);
}
}

32
database/seeders/RoleSeeder.php

@ -0,0 +1,32 @@
<?php
namespace Database\Seeders;
use App\Models\m_role;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RoleSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Role Admin
m_role::create([
'name' => 'Admin',
'description' => 'Peran admin sistem',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Role User
m_role::create([
'name' => 'User',
'description' => 'Peran pengguna biasa',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
}
}

57
database/seeders/UserSeeder.php

@ -0,0 +1,57 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\User;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
User::create([
'username' => 'admin',
'fullname' => 'Admin User',
'nip' => '12345',
'email' => 'admin@gmail.com',
'no_hp' => '1234567890',
'divisi' => 'Admin Division',
'tgl_lahir' => '1990-01-01',
'jenis_kelamin' => 'Laki-laki',
'agama' => 'Islam',
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 1, // Ganti dengan ID peran yang sesuai
'warehouse_id' => 1, // Ganti dengan ID gudang yang sesuai
'address' => 'Alamat Admin',
'email_verified_at' => now(),
'password' => bcrypt('admin'),
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// User lainnya
User::create([
'username' => 'user1',
'fullname' => 'User Satu',
'nip' => '54321',
'email' => 'user1@gmail.com',
'no_hp' => '9876543210',
'divisi' => 'Divisi Satu',
'tgl_lahir' => '1985-05-15',
'jenis_kelamin' => 'Perempuan',
'agama' => 'Kristen',
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 2, // Ganti dengan ID peran yang sesuai
'warehouse_id' => 2, // Ganti dengan ID gudang yang sesuai
'address' => 'Alamat User Satu',
'email_verified_at' => now(),
'password' => bcrypt('user1'),
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
}
}

34
database/seeders/WarehouseSeeder.php

@ -0,0 +1,34 @@
<?php
namespace Database\Seeders;
use App\Models\m_warehouse;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class WarehouseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Warehouse 1
m_warehouse::create([
'name' => 'Gudang A',
'description' => 'Gudang utama',
'address' => 'Alamat Gudang A',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Warehouse 2
m_warehouse::create([
'name' => 'Gudang B',
'description' => 'Gudang cabang',
'address' => 'Alamat Gudang B',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
}
}

11
resources/views/MasterData/asset.blade.php

@ -38,17 +38,6 @@
<th class="text-center">Action</th>
</tr>
</thead>
<!-- <tfoot>
<tr>
<th>No. Seri</th>
<th>Nama</th>
<th>Deskripsi</th>
<th>Gudang</th>
<th>Tanggal</th>
<th>QR</th>
<th class="text-center">Action</th>
</tr>
</tfoot> -->
<tbody>
@foreach ($asset as $data)
<tr>

11
resources/views/MasterData/role/create.blade.php

@ -0,0 +1,11 @@
@extends('layouts.main')
@section('title', 'Tambah Role')
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
Halaman Tambah Role
</div>
</div>
</div>
@endsection

32
resources/views/MasterData/role/edit.blade.php

@ -0,0 +1,32 @@
@extends('layouts.main')
@section('title', 'Edit Role')
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Edit Data Role</h5>
</div>
</div>
<hr class="bordered">
<form action="{{ route('dashboard.role.update', $role->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="form-group">
<label for="name" class="col-form-label">Nama Hak Akses:</label>
<input class="form-control" name="name" type="text" id="name" value="{{ $role->name }}"
placeholder="Masukan Nama Hak Akses" required>
<label for="description" class="col-form-label">Deskripsi Hak Akses:</label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Hak Akses" required>{{ $role->description }}</textarea>
</div>
<div class="modal-footer">
<a href="{{ route('dashboard.role.index') }}" class="btn btn-secondary">Kembali</a>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
@endsection

128
resources/views/MasterData/role/index.blade.php

@ -0,0 +1,128 @@
@extends('layouts.main')
@section('title', 'Role')
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Role</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal"
data-target="#tambahDataModal">
<span class="text">+ Tambah data</span>
</a>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Nama Akses</th>
<th>Deskripsi</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@php
$norole = 1;
@endphp
@foreach ($role as $data_role)
<tr>
<td>{{ $norole++ }}</td>
<td>{{ $data_role->name }}</td>
<td>{{ $data_role->description }}</td>
<td class="text-center">
<a href="#" data-toggle="modal"
data-target="#editDataModal{{ $data_role->id }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<a href="{{ route('dashboard.role.destroy', $data_role->id) }}"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')">
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Edit Data Modal-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Tambah Data</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('dashboard.role.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
<div class="form-group">
<label for="name" class="col-form-label">Nama Hak Akses:</label>
<input class="form-control" name="name" type="text" id="name"
value="{{ old('name') }}" placeholder="Masukan Nama Hak Akses" required>
<label for="description" class="col-form-label">Deskripsi Hak Akses:</label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Hak Akses" required>{{ old('description') }}</textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal Edit -->
@foreach ($role as $data)
<div class="modal fade" id="editDataModal{{ $data['id'] }}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Data Asset</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('dashboard.role.update', $data->id) }}" method="POST"
enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="form-group">
<label for="name" class="col-form-label">Nama Hak Akses:</label>
<input class="form-control" name="name" type="text" id="name"
value="{{ $data->name }}" placeholder="Masukan Nama Hak Akses" required>
<label for="description" class="col-form-label">Deskripsi Hak Akses:</label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Hak Akses"
required>{{ $data->description }}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endforeach
@endsection

11
resources/views/MasterData/role/show.blade.php

@ -0,0 +1,11 @@
@extends('layouts.main')
@section('title', 'Detail Role')
@section('content')
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
Halaman Detail Role
</div>
</div>
</div>
@endsection

8
resources/views/MasterData/user.blade.php

@ -3,14 +3,6 @@
@section('content')
{{-- <h1>Halaman Manajement User</h1> --}}
<div class="container-fluid">
<!-- <h1 class="h3 mb-2 text-gray-800">Tabel User</h1>
<div class="mb-4">
<p>Our User Tables are enhanced with the help of the DataTables plugin. This is a powerful tool that allows you
to explore return data in a more interactive and efficient way</p>
{{-- <a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<span class="text">+ Tambah data</span> --}}
</a>
</div> -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/layouts/link.blade.php

@ -1,6 +1,6 @@
<!-- Custom fonts for this template-->
<link href="{{ asset('assets/vendor/fontawesome-free/css/all.min.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('assets/vendor/fontawesome-free/css/custom.min.css') }}" rel="stylesheet" type="text/css">\
<link href="{{ asset('assets/vendor/fontawesome-free/css/custom.min.css') }}" rel="stylesheet" type="text/css">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
{{-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> --}}

2
resources/views/layouts/sidebar.blade.php

@ -41,7 +41,7 @@
<!-- Nav Item - Pages Collapse Menu -->
<li class="nav-item">
<a class="nav-link" href="#">
<a class="nav-link" href="{{ route('dashboard.role.index') }}">
<span class="ml-4">Role</span>
</a>
</li>

23
routes/web.php

@ -48,7 +48,6 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
$reminder = asset_status::whereNull('enter_at')->count();
$jumlahAsset = m_asset::count();
$jumlahPeminjaman = asset_status::count();
// $jumlahPengembalian = asset_status::count();
$jumlahPengembalian = asset_status::whereNotNull('enter_at')->count();
return view('dashboard.index', compact('jumlahAsset', 'jumlahPeminjaman', 'jumlahPengembalian', 'reminder'));
});
@ -56,22 +55,16 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
//Halaman Role
Route::controller(RoleController::class)->group(function () {
Route::get('role', 'index')->name('role.index');
Route::get('role/create', 'create')->name('role.create');
Route::post('role/store', 'store')->name('role.store');
Route::get('role/{id}', 'show')->name('role.show');
Route::get('role/{id}/edit', 'edit')->name('role.edit');
Route::put('role/{id}', 'update')->name('role.update');
Route::delete('role/delete/{id}', 'destroy')->name('role.destroy');
Route::get('role/delete/{id}', 'destroy')->name('role.destroy');
});
//Halaman Peminjaman
Route::controller(PeminjamanController::class)->group(function () {
Route::get('peminjaman', 'index')->name('peminjaman.index');
// Route::get('peminjaman/create', 'create')->name('peminjaman.create');
Route::post('peminjaman/store', 'store')->name('peminjaman.store');
// Route::get('peminjaman/{id}', 'show')->name('peminjaman.show');
// Route::get('peminjaman/{id}/edit', 'edit')->name('peminjaman.edit');
Route::put('peminjaman/{id}', 'update')->name('peminjaman.update');
Route::delete('peminjaman/delete/{id}', 'destroy')->name('peminjaman.destroy');
});
@ -89,13 +82,6 @@ Route::group(['prefix' => 'dashboard'], function () {
Route::get('/hapusAsset/{id}', [M_assetController::class, 'destroy'])->name('hapusAsset.destroy');
Route::get('/assetcetak_pdf', [M_assetController::class, 'cetakpdf'])->name('assetcetakpdf.cetakpdf');
Route::get('/assetexport', [M_assetController::class, 'export'])->name('assetexport.export');
// Route::get('/assetQR{id}', [M_assetController::class, 'QR'])->name('assetQR.QR');
// Route::get('assetQR{id}', function () {
// $path = public_path('qrcode/' . time() . '.png');
// return QrCode::size(300)
// ->generate('A simple example of QR code', $path);
// })->name('assetQR.QR');
//Halaman Manajemen User
Route::middleware('auth')->resource('/user', M_userController::class);
@ -104,13 +90,6 @@ Route::group(['prefix' => 'dashboard'], function () {
//Halaman Warehouse
Route::middleware('auth')->resource('/warehouse', WarehouseController::class);
Route::get('/hapuswarehouse/{id}', [WarehouseController::class, 'destroy'])->name('hapuswarehouse.destroy');
//Halaman Barang Masuk
// Route::middleware('auth')->resource('/barangMasuk', BarangMasukController::class);
//Halaman Barang Keluar
// Route::middleware('auth')->resource('/barangKeluar', BarangKeluarController::class);
// Route::get('/hapusBarangK/{id}', [BarangKeluarController::class, 'destroy'])->name('hapusBarangK.destroy');
});
require __DIR__ . '/auth.php';

Loading…
Cancel
Save