This commit is contained in:
Azfar Arsyad
2021-11-21 16:34:51 +08:00
parent f2104b77f5
commit 2ad8cbe355
20 changed files with 295 additions and 16807 deletions
@@ -37,4 +37,9 @@ class LoginController extends Controller
{
$this->middleware('guest')->except('logout');
}
public function username()
{
return 'username';
}
}
+2 -2
View File
@@ -112,10 +112,10 @@ class PenggunaController extends Controller
public function roles() //roles = permissions in db
{
$alluser = User::all();
$allpermission = Permission::all();
// $user = Auth::user();
// $user->assignRole('admin');
return view('pengurusanpengguna.roles',compact('alluser'));
return view('pengurusanpengguna.roles',compact('allpermission'));
}
public function updateroles(Request $request)
+13 -1
View File
@@ -19,9 +19,21 @@ class User extends Authenticatable
* @var string[]
*/
protected $fillable = [
'name',
'nama',
'email',
'password',
'kodcaw',
'nokp',
'bank_acc_pembeli',
'bank_acc_no_pembeli',
'alamat_rumah',
'notelpejabat',
'notelbimbit',
'note',
'status',
't_daftar',
'online',
'register_agree',
];
/**
+2 -1
View File
@@ -15,8 +15,9 @@ class UserFactory extends Factory
public function definition()
{
return [
'name' => $this->faker->name(),
'nama' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
't_daftar' => now(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
@@ -15,8 +15,21 @@ class CreateUsersTable extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('nama');
$table->string('kodcaw')->nullable();
$table->string('nokp')->nullable();
$table->string('bank_acc_pembeli')->nullable();
$table->string('bank_acc_no_pembeli')->nullable();
$table->string('alamat_rumah')->nullable();
$table->string('notelpejabat')->nullable();
$table->string('notelbimbit')->nullable();
$table->string('note')->nullable();
$table->string('status')->nullable();
$table->timestamp('t_daftar')->nullable();
$table->integer('online')->nullable();
$table->integer('register_agree')->nullable();
$table->string('username')->unique();
$table->string('email')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
+16 -8
View File
@@ -92,49 +92,57 @@ class RolesSeeder extends Seeder
// create demo users
$user = \App\Models\User::factory()->create([
'name' => 'Admin',
'nama' => 'Admin',
'username' => 'Admin',
'email' => 'admin@example.com',
]);
$user->assignRole($role1);
$user = \App\Models\User::factory()->create([
'name' => 'Khazanah',
'nama' => 'Khazanah',
'username' => 'Khazanah',
'email' => 'khazanah@example.com',
]);
$user->assignRole($role2);
$user = \App\Models\User::factory()->create([
'name' => 'Teller',
'nama' => 'Teller',
'username' => 'Teller',
'email' => 'teller@example.com',
]);
$user->assignRole($role3);
$user = \App\Models\User::factory()->create([
'name' => 'Pengurus Cawangan',
'nama' => 'Pengurus Cawangan',
'username' => 'PC',
'email' => 'penguruscawangan@example.com',
]);
$user->assignRole($role4);
$user = \App\Models\User::factory()->create([
'name' => 'Juru Lelong',
'nama' => 'Juru Lelong',
'username' => 'Juru Lelong',
'email' => 'jurulelong@example.com',
]);
$user->assignRole($role5);
$user = \App\Models\User::factory()->create([
'name' => 'Operasi',
'nama' => 'Operasi',
'username' => 'Operasi',
'email' => 'operasi@example.com',
]);
$user->assignRole($role6);
$user = \App\Models\User::factory()->create([
'name' => 'Account',
'nama' => 'Account',
'username' => 'Account',
'email' => 'account@example.com',
]);
$user->assignRole($role7);
$user = \App\Models\User::factory()->create([
'name' => 'Pembida',
'nama' => 'Pembida',
'username' => 'Pembida',
'email' => 'pembida@example.com',
]);
$user->assignRole($role8);
+28 -2
View File
@@ -2725,6 +2725,33 @@
"css-tree": "^1.1.2"
}
},
"datatables.net": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz",
"integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==",
"requires": {
"jquery": ">=1.7"
}
},
"datatables.net-bs4": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net-bs4/-/datatables.net-bs4-1.11.3.tgz",
"integrity": "sha512-UPT2F1nvZZzKJSSHb+3+bTeQy1ULLMT1BexBHCkh5PhMnAZNPbTEZD+6To1RCBfUF1rtPwIJTwJ+Jjjxy86xRw==",
"dev": true,
"requires": {
"datatables.net": ">=1.10.25",
"jquery": ">=1.7"
}
},
"datatables.net-dt": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net-dt/-/datatables.net-dt-1.11.3.tgz",
"integrity": "sha512-EX/thRwXpQRj8hZSb+ZMDNQ4uW1zLZa9BoAhhw1b5HIDH1nJ9WRTkERsoxE+3WISeX8bDiaEydf8TTQBSqxXVw==",
"requires": {
"datatables.net": ">=1.10.25",
"jquery": ">=1.7"
}
},
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
@@ -4175,8 +4202,7 @@
"jquery": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==",
"dev": true
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
},
"jquery-ui": {
"version": "1.13.0",
+4 -1
View File
@@ -12,6 +12,7 @@
"devDependencies": {
"axios": "^0.21",
"bootstrap": "^4.6.0",
"datatables.net-bs4": "^1.11.3",
"jquery": "^3.6",
"jquery-ui": "^1.13.0",
"laravel-mix": "^6.0.6",
@@ -23,6 +24,8 @@
"sass-loader": "^11.0.1"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4"
"@fortawesome/fontawesome-free": "^5.15.4",
"datatables.net": "^1.11.3",
"datatables.net-dt": "^1.11.3"
}
}
+7 -16123
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -590
View File
File diff suppressed because one or more lines are too long
+72
View File
@@ -0,0 +1,72 @@
/*!
* Bootstrap v4.6.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/
/*! DataTables 1.11.3
* ©2008-2021 SpryMedia Ltd - datatables.net/license
*/
/*! DataTables Bootstrap 4 integration
* ©2011-2017 SpryMedia Ltd - datatables.net/license
*/
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
/* @import '~datatables.net-bs4/css/dataTables.bootstrap4.css'; */
+7 -1
View File
@@ -1 +1,7 @@
require('./bootstrap');
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('./bootstrap');
require('datatables.net-bs4');
} catch (e) {}
+2 -2
View File
@@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="">
<div class="container-fluid">
<button type="button" id="sidebarCollapse" class="btn btn-info">
<button type="button" id="sidebarCollapse" class="btn btn-outline-secondary">
<i class="fa fa-bars"></i>
</button>
<button class="btn btn-dark d-inline-block d-lg-none ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" style="">
@@ -20,7 +20,7 @@
</li> -->
</ul>
<div class="group">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ Auth::user()->name }} </button>
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{ Auth::user()->nama }} </button>
<div class="dropdown-menu dropdown-menu-right mr-2">
<button class="dropdown-item" type="button"><i class="fa fa-user"></i> Profile</button>
{{-- logout --}}
@@ -24,45 +24,54 @@
</div>
@endif
<table class="table table-bordered">
<tr>
<th>No</th>
<th>Nama</th>
<th>Emails</th>
<th>Taraf</th>
<th>Action</th>
</tr>
@foreach ($alluser as $user)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>
@foreach ($user->roles as $taraf)
<p>{{$taraf->name}}</p>
<table class="table table-bordered" id="pengguna">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Emails</th>
<th>Taraf</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($alluser as $user)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $user->nama }}</td>
<td>{{ $user->email }}</td>
<td>
@foreach ($user->roles as $taraf)
<p>{{$taraf->name}}</p>
@endforeach
</td>
<td>
<a class="btn btn-info" href="{{ route('pengguna.show',$user->id) }}">Edit</a>
{{-- <form action="{{ route('pengguna.updatepengguna',$user->id) }}" method="POST">
<a class="btn btn-info" href="{{ route('users.show',$user->id) }}">Show</a>
<a class="btn btn-primary" href="{{ route('users.edit',$user->id) }}">Edit</a>
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button> --}}
</form>
</td>
</tr>
@endforeach
</td>
<td>
<a class="btn btn-info" href="{{ route('pengguna.show',$user->id) }}">Edit</a>
{{-- <form action="{{ route('pengguna.updatepengguna',$user->id) }}" method="POST">
<a class="btn btn-info" href="{{ route('users.show',$user->id) }}">Show</a>
<a class="btn btn-primary" href="{{ route('users.edit',$user->id) }}">Edit</a>
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button> --}}
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready( function () {
$('#pengguna').DataTable();
} );
</script>
@endsection
@@ -3,25 +3,43 @@
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Dashboard') }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
you can manage roles!
<div class="col-md-12">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
</div>
@endif
<table class="table table-bordered" id="roles">
<thead>
<tr>
<th>No</th>
<th>Roles</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($allpermission as $role)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $role->name }}</td>
<td>
<a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready( function () {
$('#roles').DataTable();
} );
</script>
@endsection
@@ -10,31 +10,41 @@
</div>
@endif
<table class="table table-bordered">
<tr>
<th>No</th>
<th>Taraf</th>
<th>Roles</th>
<th>Action</th>
</tr>
@foreach ($roles as $role)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $role->name }}</td>
{{-- <td>{{ $role->email }}</td> --}}
<td>
@foreach ($role->permissions->pluck('name') as $taraf)
<p>{{$taraf}}</p>
<table class="table table-bordered" id="taraf">
<thead>
<tr>
<th>No</th>
<th>Taraf</th>
<th>Roles</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($roles as $role)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $role->name }}</td>
{{-- <td>{{ $role->email }}</td> --}}
<td>
@foreach ($role->permissions->pluck('name') as $taraf)
<p>{{$taraf}}</p>
@endforeach
</td>
<td>
<a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a>
</form>
</td>
</tr>
@endforeach
</td>
<td>
<a class="btn btn-info" href="{{ route('pengguna.showtaraf',$role->id) }}">Edit</a>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
$(document).ready( function () {
$('#taraf').DataTable();
} );
</script>
@endsection
+8 -3
View File
@@ -33,14 +33,19 @@
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="form-group">
{{-- <input id="email" type="email" class="form-control" placeholder="No. Kad Pengenalan" > --}}
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" placeholder="Email" autofocus>
<input id="username" type="text" class="form-control @error('username') is-invalid @enderror" name="username" value="{{ old('username') }}" required autocomplete="username" placeholder="Username" autofocus>
{{-- <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" placeholder="Email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
@enderror --}}
@error('username')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="form-group mb-3">
{{-- <input type="password" class="form-control" placeholder="Katalaluan" id="form10"> --}}