Compare commits

...

78 Commits
master ... dev

Author SHA1 Message Date
bb59625753 add datatable export 2024-05-19 18:23:34 +07:00
841837f541 fix logout 2024-02-01 11:31:06 +07:00
0e251f2fa7 remove dupliicate breadcrumb 2024-01-11 18:06:37 +07:00
a669fd602f Merge branch 'dev' of https://git.putrakuningan.com/putrakuningan/file-management-system into dev 2024-01-03 08:27:59 +07:00
613e4e0ab2 update menu 2024-01-03 08:27:55 +07:00
46d0298d18 update view - metronic 8.2.2 2024-01-02 17:59:06 +07:00
aca5f64929 update resource mix - metronic 8.2.2 2024-01-02 17:56:18 +07:00
c462248518 update metronic 8.2.2 2024-01-02 17:55:00 +07:00
371c546168 update layout 2023-12-20 17:35:55 +07:00
0b05d0b576 update favicon 2023-12-19 18:01:19 +07:00
07c8052fce Merge branch 'dev' of https://git.putrakuningan.com/putrakuningan/file-management-system into dev 2023-12-19 09:35:44 +07:00
ff4bd26923 update menu 2023-12-19 09:35:22 +07:00
a060ff64d8 update detail pinjaman 2023-12-15 14:55:52 +07:00
fcd9b89011 update logo agi 2023-12-14 16:59:17 +07:00
Daeng Deni Mardaeni
fc15f678b1 update resources 2023-11-22 17:59:53 +07:00
Daeng Deni Mardaeni
b781eceef4 fix resources path 2023-11-21 15:26:00 +07:00
Daeng Deni Mardaeni
8479eb8998 update menu 2023-11-06 11:37:05 +07:00
Daeng Deni Mardaeni
1c297c9c8a Update Metronic v8.2.1 2023-11-03 16:12:15 +07:00
Daeng Deni Mardaeni
054743f3a0 update livewire 2023-10-05 23:02:43 +07:00
Daeng Deni Mardaeni
d39d596513 remove unused code 2023-09-27 15:44:26 +07:00
Daeng Deni Mardaeni
56916e826b update breadcrumb 2023-09-27 15:06:57 +07:00
Daeng Deni Mardaeni
c73ea1b54c update metronic 8.2 2023-09-26 16:51:59 +07:00
Daeng Deni Mardaeni
4c730a3b7a update to metronic v8.2.0 2023-09-26 16:39:39 +07:00
Daeng Deni Mardaeni
01ca6abd6d Fix : Tombol Add Hilang dari penambahan Cardboard 2023-09-20 17:33:07 +07:00
Daeng Deni Mardaeni
68a847f83d feature: add function _countDocumentOnCardboard 2023-09-20 13:57:25 +07:00
Daeng Deni Mardaeni
d0bf4e55be update toolbar 2023-09-20 13:47:58 +07:00
Daeng Deni Mardaeni
e3f6b2bd9c update toolbar 2023-09-04 15:39:59 +07:00
Daeng Deni Mardaeni
d9107597c3 update toolbar 2023-08-31 15:40:57 +07:00
Daeng Deni Mardaeni
63ef9746f4 update toolbar add document odner 2023-08-31 15:10:00 +07:00
Daeng Deni Mardaeni
4cc9a01401 update page toolbar 2023-08-31 14:53:57 +07:00
Daeng Deni Mardaeni
e06eefd4e2 Fix Missing FIle 2023-08-10 22:31:58 +07:00
ee7c41e2cb update composer.json 2023-08-10 21:32:18 +07:00
7e2c42a463 update for sit 2023-08-10 21:30:05 +07:00
Daeng Deni Mardaeni
b86fdbfb99 add bg 2023-08-09 17:14:19 +07:00
Daeng Deni Mardaeni
2346a4a852 update auth layout 2023-07-21 16:33:53 +07:00
0cf61a402f update toolbar 2023-07-20 09:43:59 +07:00
f4f1dc2c25 update logos 2023-07-10 09:14:20 +07:00
Daeng Deni Mardaeni
bf4facb148 update sidebar layout 2023-07-05 17:35:34 +07:00
315a9afaaf add module warehouse 2023-06-10 21:56:23 +07:00
2b26aa9da3 update composer module 2023-06-10 20:03:49 +07:00
3c946de35e update composer 2023-06-10 20:02:13 +07:00
e403fb8062 add module product repository 2023-06-10 20:00:36 +07:00
4d0ae48d3f update page title and toolbar 2023-06-10 19:10:34 +07:00
5ef51b86cc fix module statues 2023-06-08 13:05:48 +07:00
4106404907 Update module status 2023-06-08 13:04:56 +07:00
f1d27b1de7 update webpack 2023-06-08 13:01:15 +07:00
445e070738 Update Sidebar Menu 2023-06-04 21:05:34 +07:00
169bf77a5c Update Sidebar Menu 2023-06-04 14:26:15 +07:00
344e2a96dc Update Repository Module 2023-06-04 10:53:46 +07:00
95d6a1f216 Add Menu Buyer 2023-06-03 21:25:45 +07:00
a6ba325874 Add Module Supplier 2023-06-03 21:10:48 +07:00
9281424176 Update Menu 2023-06-03 20:50:41 +07:00
03244e3486 update menu 2023-05-26 09:53:30 +07:00
cbec454402 Update Locale 2023-05-26 09:33:02 +07:00
05b26a4b95 Update Helper & Sample .env 2023-05-25 17:38:40 +07:00
4d2959b538 Add Logo AGI 2023-05-25 11:00:04 +07:00
0ab8abda5f Add Setting Migration dan module qrcode 2023-05-25 10:49:46 +07:00
19001d8530 update comooser 2023-05-23 18:19:14 +07:00
80a4a27df2 Merge remote-tracking branch 'origin/submodule' into submodule 2023-05-22 21:45:43 +07:00
78253e7b21 Update Menu 2023-05-22 21:43:57 +07:00
5b65bae426 Delete 'composer.lock' 2023-05-20 14:31:44 +00:00
71068046de update gitignore 2023-05-20 21:30:36 +07:00
8c71f3cbe1 remove putrakuningan module 2023-05-20 21:27:28 +07:00
a90f775f2a remove unused function 2023-05-20 21:08:17 +07:00
26e32d4d54 Delete unused file and folder 2023-05-16 16:56:59 +07:00
e736b5b6cc update core : move logs to modules 2023-05-16 10:18:32 +07:00
e7403cb94f add blank page 2023-05-15 21:03:24 +07:00
f27e69d51f update gitignore 2023-05-15 21:01:34 +07:00
26f2b816a3 Update '.gitmodules' 2023-05-15 11:31:17 +00:00
67ef3c368e delete modules 2023-05-15 18:17:44 +07:00
bd3233494e submoduke 2023-05-15 18:15:36 +07:00
6033e1850a Merge branch 'modular' of https://git.putrakuningan.com/putrakuningan/cetak-label into modular
# Conflicts:
#	Modules/CetakLabel/Routes/api.php
2023-05-15 10:16:35 +07:00
6f91525f6e update module cetak label 2023-05-15 10:13:09 +07:00
9bfae06272 update route 2023-05-12 09:40:41 +07:00
cb0793fde0 Add module Cetak label 2023-05-11 08:29:47 +07:00
4e95c29411 add modular 2023-05-10 22:15:50 +07:00
38ba8fac54 Merge remote-tracking branch 'origin/master' into new
# Conflicts:
#	composer.lock
2023-05-08 13:24:53 +07:00
eea0e3d304 update doc block 2023-05-05 07:54:31 +07:00
2278 changed files with 248775 additions and 40146 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,9 +1,14 @@
APP_NAME=Laravel
APP_NAME="File Management System"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
METHOD_AUTH=usermanager
IP_USER_MANAGER=10.0.20.68
PORT_USER_MANAGER=82
APP_ID=WOF
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

3
.gitignore vendored
View File

@ -6,6 +6,7 @@
/public/mix-manifest.json
/storage/*.key
/vendor
/Modules/*
.env
.env.backup
.phpunit.result.cache
@ -16,3 +17,5 @@ npm-debug.log
yarn-error.log
/.idea
/.vscode
composer.lock
*.lock

0
Modules/index.html Normal file
View File

BIN
app/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
<?php
namespace App\Actions;
class GetThemeType
{
public array $types = ['primary', 'success', 'info', 'danger', 'warning'];
public int $seed;
public function handle($format = '?', $seed = '')
{
$this->seed = crc32($seed);
return str_replace('?', $this->randomType(), $format);
}
public function randomType()
{
srand($this->seed);
return $this->types[rand(0, count($this->types) - 1)] ?? '';
}
}

View File

@ -0,0 +1,100 @@
<?php
namespace App\Actions;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Spatie\Permission\Models\Permission;
class SamplePermissionApi
{
public function datatableList(Request $request)
{
$draw = $request->input('draw', 0);
$start = $request->input('start', 0);
$length = $request->input('length', 10);
$columns = $request->input('columns');
$searchValue = $request->input('search.value');
$orderColumn = $request->input('order.0.column', 0); // Get the order column index
$orderDir = $request->input('order.0.dir', 'asc'); // Get the order direction (ASC or DESC)
$query = Permission::query()->with('roles');
if ($searchValue) {
$searchColumns = ['name'];
$query->where(function ($query) use ($searchValue, $searchColumns) {
foreach ($searchColumns as $column) {
$query->orWhere(DB::raw("LOWER($column)"), 'LIKE', '%' . strtolower($searchValue) . '%');
}
});
}
// Get the column name for ordering based on the orderColumn index
$orderColumnName = $columns[$orderColumn]['data'] ?? 'id';
// Apply ordering to the query
$query->orderBy($orderColumnName, $orderDir);
$totalRecords = $query->count();
$records = $query->offset($start)->limit($length)->get();
$data = [
'draw' => $draw,
'recordsTotal' => $totalRecords,
'recordsFiltered' => $totalRecords,
'data' => $records,
'orderColumnName' => $orderColumnName,
];
return $data;
}
public function create(Request $request)
{
$permission = $request->all();
$rules = [
'name' => 'required|string',
];
$validator = Validator::make($permission, $rules);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 400);
}
$updated = Permission::create($permission);
return response()->json(['success' => $updated]);
}
public function get($id)
{
return Permission::findOrFail($id);
}
public function update($id, Request $request)
{
$permission = $request->all();
$rules = [
'name' => 'required|string',
];
$validator = Validator::make($permission, $rules);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 400);
}
$updated = Permission::findOrFail($id)->update($permission);
return response()->json(['success' => $updated]);
}
public function delete($id)
{
return Permission::destroy($id);
}
}

View File

@ -0,0 +1,171 @@
<?php
namespace App\Actions;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Spatie\Permission\Models\Role;
class SampleRoleApi
{
public $roles_description = [
'administrator' => 'Best for business owners and company administrators',
'developer' => 'Best for developers or people primarily using the API',
'analyst' => 'Best for people who need full access to analytics data, but don\'t need to update business settings',
'support' => 'Best for employees who regularly refund payments and respond to disputes',
'trial' => 'Best for people who need to preview content data, but don\'t need to make any updates',
];
public function datatableList(Request $request)
{
$draw = $request->input('draw', 0);
$start = $request->input('start', 0);
$length = $request->input('length', 10);
$columns = $request->input('columns');
$searchValue = $request->input('search.value');
$orderColumn = $request->input('order.0.column', 0); // Get the order column index
$orderDir = $request->input('order.0.dir', 'asc'); // Get the order direction (ASC or DESC)
$query = Role::query()->with('permissions')->with('users');
if ($searchValue) {
$searchColumns = ['name'];
$query->where(function ($query) use ($searchValue, $searchColumns) {
foreach ($searchColumns as $column) {
$query->orWhere(DB::raw("LOWER($column)"), 'LIKE', '%' . strtolower($searchValue) . '%');
}
});
}
// Get the column name for ordering based on the orderColumn index
$orderColumnName = $columns[$orderColumn]['data'] ?? 'id';
// Apply ordering to the query
$query->orderBy($orderColumnName, $orderDir);
$totalRecords = $query->count();
$records = $query->offset($start)->limit($length)->get();
foreach ($records as $i => $role) {
$records[$i]->description = $this->roles_description[$role->name] ?? '';
}
$data = [
'draw' => $draw,
'recordsTotal' => $totalRecords,
'recordsFiltered' => $totalRecords,
'data' => $records,
'orderColumnName' => $orderColumnName,
];
return $data;
}
public function usersDatatableList(Request $request)
{
$role_id = $request->input('id', 0);
$draw = $request->input('draw', 0);
$start = $request->input('start', 0);
$length = $request->input('length', 10);
$columns = $request->input('columns');
$searchValue = $request->input('search.value');
$orderColumn = $request->input('order.0.column', 0); // Get the order column index
$orderDir = $request->input('order.0.dir', 'asc'); // Get the order direction (ASC or DESC)
$query = User::whereHas('roles', function ($query) use ($role_id) {
$query->where('id', $role_id);
})->with('roles');
if ($searchValue) {
$searchColumns = ['name'];
$query->where(function ($query) use ($searchValue, $searchColumns) {
foreach ($searchColumns as $column) {
$query->orWhere(DB::raw("LOWER($column)"), 'LIKE', '%' . strtolower($searchValue) . '%');
}
});
}
// Get the column name for ordering based on the orderColumn index
$orderColumnName = $columns[$orderColumn]['data'] ?? 'id';
// Apply ordering to the query
$query->orderBy($orderColumnName, $orderDir);
$totalRecords = $query->count();
$records = $query->offset($start)->limit($length)->get();
$data = [
'role_id' => $role_id,
'draw' => $draw,
'recordsTotal' => $totalRecords,
'recordsFiltered' => $totalRecords,
'data' => $records,
'orderColumnName' => $orderColumnName,
];
return $data;
}
public function create(Request $request)
{
$role = $request->all();
$rules = [
'name' => 'required|string',
];
$validator = Validator::make($role, $rules);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 400);
}
$updated = Role::create($role);
return response()->json(['success' => $updated]);
}
public function get($id, $relations = ['permissions', 'users'])
{
return Role::with($relations)->findOrFail($id);
}
public function update($id, Request $request)
{
$role = $request->all();
$rules = [
'name' => 'required|string',
];
$validator = Validator::make($role, $rules);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 400);
}
$updated = Role::findOrFail($id)->update($role);
return response()->json(['success' => $updated]);
}
public function delete($id)
{
return Role::destroy($id);
}
public function deleteUser($id, $user_id = null)
{
$user = User::find($user_id);
if ($user) {
return $user->roles()->detach($id);
}
return false;
}
}

View File

@ -0,0 +1,102 @@
<?php
namespace App\Actions;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
class SampleUserApi
{
public function datatableList(Request $request)
{
$draw = $request->input('draw', 0);
$start = $request->input('start', 0);
$length = $request->input('length', 10);
$columns = $request->input('columns');
$searchValue = $request->input('search.value');
$orderColumn = $request->input('order.0.column', 0); // Get the order column index
$orderDir = $request->input('order.0.dir', 'asc'); // Get the order direction (ASC or DESC)
$query = User::query()->with('roles');
if ($searchValue) {
$searchColumns = ['name', 'email'];
$query->where(function ($query) use ($searchValue, $searchColumns) {
foreach ($searchColumns as $column) {
$query->orWhere(DB::raw("LOWER($column)"), 'LIKE', '%' . strtolower($searchValue) . '%');
}
});
}
// Get the column name for ordering based on the orderColumn index
$orderColumnName = $columns[$orderColumn]['data'] ?? 'id';
// exclude core user for demo purpose
$query->whereNotIn('id', [1]);
// Apply ordering to the query
$query->orderBy($orderColumnName, $orderDir);
$totalRecords = $query->count();
$records = $query->offset($start)->limit($length)->get();
$data = [
'draw' => $draw,
'recordsTotal' => $totalRecords,
'recordsFiltered' => $totalRecords,
'data' => $records,
'orderColumnName' => $orderColumnName,
];
return $data;
}
public function create(Request $request)
{
$user = $request->all();
$rules = [
'name' => 'required|string',
'email' => 'required|email|unique:users,email',
];
$validator = Validator::make($user, $rules);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 400);
}
$updated = User::create($user);
return response()->json(['success' => $updated]);
}
public function get($id)
{
return User::findOrFail($id);
}
public function update($id, Request $request)
{
$data = $request->validate([
'name' => 'required|string',
'email' => 'required|email|unique:users,email,' . $id,
'role' => 'required|string',
]);
$user = User::findOrFail($id);
$user->update($data);
$user->assignRole($request->role);
return response()->json(['success' => true]);
}
public function delete($id)
{
return User::destroy($id);
}
}

View File

@ -25,15 +25,7 @@ class BootstrapDefault
public function initAssets()
{
# Include global vendors
addVendors(['datatables', 'fullcalendar']);
# Include global javascript files
addJavascriptFile('assets/js/custom/widgets.js');
addJavascriptFile('assets/js/custom/apps/chat/chat.js');
addJavascriptFile('assets/js/custom/utilities/modals/upgrade-plan.js');
addJavascriptFile('assets/js/custom/utilities/modals/create-app.js');
addJavascriptFile('assets/js/custom/utilities/modals/users-search.js');
addJavascriptFile('assets/js/custom/utilities/modals/new-target.js');
addVendors(['datatables']);
}
public function initDarkSidebarLayout()

45
app/Core/KTBootstrap.php Normal file
View File

@ -0,0 +1,45 @@
<?php
namespace App\Core;
class KTBootstrap
{
// Init theme mode option from settings
public static function init()
{
KTBootstrap::initThemeMode();
KTBootstrap::initThemeDirection();
KTBootstrap::initLayout();
}
// Init theme direction option (RTL or LTR) from settings
// Init RTL html attributes by checking if RTL is enabled.
// This function is being called for the html tag
public static function initThemeMode()
{
setModeSwitch(config('settings.KT_THEME_MODE_SWITCH_ENABLED'));
setModeDefault(config('settings.KT_THEME_MODE_DEFAULT'));
}
// Init layout html attributes and classes
public static function initThemeDirection()
{
setDirection(config('settings.KT_THEME_DIRECTION'));
if (isRtlDirection()) {
addHtmlAttribute('html', 'direction', 'rtl');
addHtmlAttribute('html', 'dir', 'rtl');
addHtmlAttribute('html', 'style', 'direction: rtl');
}
}
// Main initialization
public static function initLayout()
{
addHtmlAttribute('body', 'id', 'kt_app_body');
addHtmlAttribute('body', 'data-kt-name', getName());
}
}

View File

@ -231,7 +231,7 @@ class Theme
function extendCssFilename($path)
{
if ($this->isRtlDirection()) {
$path = str_replace('.css', '.rtl.css');
$path = str_replace('.css', '.rtl.css', $path);
}
return $path;
@ -280,8 +280,9 @@ class Theme
*/
function getGlobalAssets($type = 'js')
{
// $this->extendCssFilename()
return config('settings.KT_THEME_ASSETS.global.'.$type);
return array_map(function($path) {
return $this->extendCssFilename($path);
}, config('settings.KT_THEME_ASSETS.global.'.$type));
}
/**
@ -391,12 +392,10 @@ class Theme
return self::$htmlAttributes[$scope][$attribute] ?? [];
}
function getIcon($name, $class = '', $type = '')
function getIcon($name, $class = '', $type = '', $tag = 'span')
{
$type = config('settings.KT_THEME_ICONS', 'duotone');
$tag = 'span';
if ($type === 'duotone') {
$icons = cache()->remember('duotone-icons', 3600, function () {
return json_decode(file_get_contents(public_path('icons.json')), true);

View File

@ -1,89 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\Directorat;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class DirectoratDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%");
}
})
->addIndexColumn()
->addColumn('action', 'pages.masters.directorat._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(Directorat $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('directorat-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Directorat_' . date('YmdHis');
}
}

View File

@ -1,128 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\Document;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class DocumentDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%");
}
})
->addColumn('kode_directorat',function($model){
return $model->directorat->kode;
})
->addColumn('name_directorat',function($model){
return $model->directorat->name;
})
->addColumn('kode_sub_directorat',function($model){
return $model->sub_directorat->kode;
})
->addColumn('name_sub_directorat',function($model){
return $model->sub_directorat->name;
})
->addColumn('kode_pekerjaan',function($model){
return $model->job->kode;
})
->addColumn('name_pekerjaan',function($model){
return $model->job->name;
})
->addColumn('kode_sub_pekerjaan',function($model){
return $model->sub_job->kode;
})
->addColumn('name_sub_pekerjaan',function($model){
return $model->sub_job->name;
})
->addColumn('kode_sub_sub_pekerjaan',function($model){
return $model->sub_sub_job->kode;
})
->addColumn('name_sub_sub_pekerjaan',function($model){
return $model->sub_sub_job->name;
})
->addIndexColumn()
->addColumn('action', 'pages.app.document._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(Document $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('document-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('kode'),
Column::make('kode_directorat')->title('Kode Direktorat'),
Column::make('name_directorat')->title('Nama Direktorat'),
Column::make('kode_sub_directorat')->title('Kode Sub Direktorat'),
Column::make('name_sub_directorat')->title('Nama Sub Direktorat'),
Column::make('kode_pekerjaan')->title('Kode Pekerjaan'),
Column::make('name_pekerjaan')->title('Nama Pekerjaan'),
Column::make('kode_sub_pekerjaan')->title('Kode Sub Pekerjaan'),
Column::make('name_sub_pekerjaan')->title('Nama Sub Pekerjaan'),
Column::make('kode_sub_sub_pekerjaan')->title('Kode Sub Sub Pekerjaan'),
Column::make('name_sub_sub_pekerjaan')->title('Nama Sub Sub Pekerjaan'),
Column::make('status'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Document_' . date('YmdHis');
}
}

View File

@ -1,89 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\DocumentType;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class DocumentTypeDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%");
}
})
->addIndexColumn()
->addColumn('action', 'pages.app.document-type._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(DocumentType $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('document-type-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Document_Type_' . date('YmdHis');
}
}

View File

@ -1,99 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\Job;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class JobDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%');
}
})
->addIndexColumn()
->addColumn('directorat', function ($job) {
return $job->directorat->name;
})
->addColumn('sub_directorat', function ($job) {
return $job->subDirectorat->name;
})
->addColumn('action', 'pages.masters.job._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(Job $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('job-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('directorat'),
Column::make('sub_directorat'),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Job_' . date('YmdHis');
}
}

View File

@ -1,120 +0,0 @@
<?php
namespace App\DataTables\Logs;
use Spatie\Activitylog\Models\Activity;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class AuditLogsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->rawColumns(['description', 'properties', 'action'])
->editColumn('id', function (Activity $model) {
return $model->id;
})
->editColumn('subject_id', function (Activity $model) {
if (!isset($model->subject)) {
return '';
}
if (isset($model->subject->name)) {
return $model->subject->name;
}
return $model->subject->user()->first()->name;
})
->editColumn('causer_id', function (Activity $model) {
return $model->causer ? $model->causer->name : __('System');
})
->editColumn('properties', function (Activity $model) {
$content = $model->properties;
return view('pages.log.audit._details', compact('content'));
})
->editColumn('created_at', function (Activity $model) {
return $model->created_at->format('d M, Y H:i:s');
})
->addColumn('action', function (Activity $model) {
return view('pages.log.audit._action-menu', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param Activity $model
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Activity $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('audit-log-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(6)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('id')->title('Log ID'),
Column::make('log_name')->title(__('Location')),
Column::make('description'),
Column::make('subject_type'),
Column::make('subject_id')->title(__('Subject')),
Column::make('causer_id')->title(__('Causer')),
Column::make('created_at'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
Column::make('properties')->addClass('none'),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'DataLogs_'.date('YmdHis');
}
}

View File

@ -1,143 +0,0 @@
<?php
namespace App\DataTables\Logs;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Jackiedo\LogReader\Exceptions\UnableToRetrieveLogFilesException;
use Jackiedo\LogReader\LogReader;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class SystemLogsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
*
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->collection($query)
->rawColumns(['action', 'level'])
->editColumn('id', function (Collection $model) {
return Str::limit($model->get('id'), 5, '');
})
->editColumn('file_path', function (Collection $model) {
return Str::limit($model->get('file_path'));
})
->editColumn('message', function (Collection $model) {
return Str::limit($model->get('context')->message, 95);
})
->editColumn('date', function (Collection $model) {
return $model->get('date')->format('d M, Y H:i:s');
})
->editColumn('level', function (Collection $model) {
$styles = [
'emergency' => 'danger',
'alert' => 'warning',
'critical' => 'danger',
'error' => 'danger',
'warning' => 'warning',
'notice' => 'success',
'info' => 'info',
'debug' => 'primary',
];
$style = 'info';
if (isset($styles[$model->get('level')])) {
$style = $styles[$model->get('level')];
}
$value = $model->get('level');
return '<div class="badge badge-light-'.$style.' fw-bolder">'.$value.'</div>';
})
->editColumn('context', function (Collection $model) {
$content = $model->get('context');
return view('pages.log.system._details', compact('content'));
})
->addColumn('action', function (Collection $model) {
return view('pages.log.system._action-menu', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param LogReader $model
*
* @return Collection
*/
public function query(LogReader $model)
{
$data = collect();
$model->setLogPath(storage_path('logs'));
try {
$data = $model->get()->merge($data);
} catch (UnableToRetrieveLogFilesException $exception) {
}
$data = $data->map(function ($a) {
return (collect($a))->only(['id', 'date', 'environment', 'level', 'file_path', 'context']);
});
return $data;
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('system-log-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(true)
->orderBy(3)
->responsive()
->autoWidth(false)
->parameters(['scrollX' => true])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('id')->title('Log ID')->width(50),
Column::make('message'),
Column::make('level'),
Column::make('date')->width(130),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
Column::make('environment')->addClass('none'),
Column::make('file_path')->title(__('Log Path'))->addClass('none'),
Column::make('context')->addClass('none'),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'SystemLogs_'.date('YmdHis');
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\DataTables;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Spatie\Permission\Models\Permission;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class PermissionsDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->editColumn('name', function (Permission $permission) {
return ucwords($permission->name);
})
->addColumn('assigned_to', function (Permission $permission) {
$roles = $permission->roles;
return view('pages/apps.user-management.permissions.columns._assign-to', compact('roles'));
})
->editColumn('created_at', function (Permission $permission) {
return $permission->created_at->format('d M Y, h:i a');
})
->addColumn('actions', function (Permission $permission) {
return view('pages/apps.user-management.permissions.columns._actions', compact('permission'));
})
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(Permission $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('permissions-table')
->columns($this->getColumns())
->minifiedAjax()
->dom('rt' . "<'row'<'col-sm-12 col-md-5'l><'col-sm-12 col-md-7'p>>",)
->addTableClass('table align-middle table-row-dashed fs-6 gy-5 dataTable no-footer text-gray-600 fw-semibold')
->setTableHeadClass('text-start text-muted fw-bold fs-7 text-uppercase gs-0')
->orderBy(0)
->drawCallback("function() {" . file_get_contents(resource_path('views/pages/apps/user-management/permissions/columns/_draw-scripts.js')) . "}");
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('name'),
Column::make('assigned_to'),
Column::make('created_at')->addClass('text-nowrap'),
Column::computed('actions')
->addClass('text-end text-nowrap')
->exportable(false)
->printable(false),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Permissions_' . date('YmdHis');
}
}

View File

@ -1,89 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\SpecialCode;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SpecialCodeDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%");
}
})
->addIndexColumn()
->addColumn('action', 'pages.masters.special-code._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(SpecialCode $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('special-code-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Special_Code_' . date('YmdHis');
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\SubDirectorat;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubDirectoratDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%');
}
})
->addIndexColumn()
->addColumn('directorat', function ($subDirectorat) {
return $subDirectorat->directorat->name;
})
->addColumn('action', 'pages.masters.sub-directorat._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(SubDirectorat $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('sub-directorat-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('directorat'),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Sub_Directorat_' . date('YmdHis');
}
}

View File

@ -1,104 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\SubJob;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubJobDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%');
}
})
->addIndexColumn()
->addColumn('directorat', function ($subJob) {
return $subJob->directorat->name;
})
->addColumn('sub_directorat', function ($subJob) {
return $subJob->subDirectorat->name;
})
->addColumn('job', function ($subJob) {
return $subJob->job->name;
})
->addColumn('action', 'pages.masters.sub-job._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(SubJob $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('sub-job-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('directorat'),
Column::make('sub_directorat'),
Column::make('job'),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Sub_Job_' . date('YmdHis');
}
}

View File

@ -1,109 +0,0 @@
<?php
namespace App\DataTables;
use App\Models\SubSubJob;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubSubJobDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subJob', 'name', 'like', '%'.$search['value'].'%');
}
})
->addIndexColumn()
->addColumn('directorat', function ($subJob) {
return $subJob->directorat->name;
})
->addColumn('sub_directorat', function ($subJob) {
return $subJob->subDirectorat->name;
})
->addColumn('job', function ($subJob) {
return $subJob->job->name;
})
->addColumn('sub_job', function ($subJob) {
return $subJob->subJob->name;
})
->addColumn('action', 'pages.masters.sub-sub-job._action')
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(SubSubJob $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('sub-sub-job-table')
->columns($this->getColumns())
->minifiedAjax()
->stateSave(false)
->responsive()
->autoWidth(true)
->orderBy(1)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('directorat'),
Column::make('sub_directorat'),
Column::make('job'),
Column::make('sub_job'),
Column::make('kode'),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Sub_Sub_Job_' . date('YmdHis');
}
}

View File

@ -1,102 +0,0 @@
<?php
namespace App\DataTables\Users;
use App\Models\PermissionGroup;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class PermissionsDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('name', 'like', "%" . $search['value'] . "%");
}
})
->rawColumns(['action','role'])
->addIndexColumn()
->addColumn('name', function (PermissionGroup $model) {
return $model->name;
})
->addColumn('role', function (PermissionGroup $model){
$role = $model->roles($model);
return view('pages.users.permissions._checkbox', compact('role'));
})
->addColumn('action', function (PermissionGroup $model) {
return view('pages.users.permissions._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\PermissionGroup $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(PermissionGroup $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-permissions-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name')->title('Name'),
Column::make('role')->title('Assign To'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export
* @return string
*/
protected function filename() : string
{
return 'Permissions_' . date('YmdHis');
}
}

View File

@ -1,96 +0,0 @@
<?php
namespace App\DataTables\Users;
use Spatie\Permission\Models\Role;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class RolesDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->rawColumns(['action'])
->addIndexColumn()
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('name', 'like', "%" . $search['value'] . "%");
}
})
->addColumn('action', function (Role $model) {
return view('pages.users.roles._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\Role $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Role $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-roles-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'Roles_' . date('YmdHis');
}
}

View File

@ -1,97 +0,0 @@
<?php
namespace App\DataTables\Users;
use App\Models\User;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->filter(function ($query) {
$search = request()->get('search');
if ($search['value']!=="") {
$query->where('name', 'like', "%" . $search['value'] . "%")
->orWhere('email', 'like', "%" . $search['value'] . "%");
}
})
->rawColumns(['action'])
->addIndexColumn()
->addColumn('action', function (User $model) {
return view('pages.users.users._action', compact('model'));
});
}
/**
* Get query source of dataTable.
*
* @param \App\Models\User $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(User $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('user-users-table')
->columns($this->getColumns())
->minifiedAjax()
->orderBy(1,'asc')
->stateSave(false)
->responsive()
->autoWidth(false)
->parameters([
'scrollX' => true,
'drawCallback' => 'function() { KTMenu.createInstances(); }',
])
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
Column::make('name')->title(__('Name')),
Column::make('email'),
Column::computed('action')
->exportable(false)
->printable(false)
->addClass('text-center')
->responsivePriority(-1),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename() : string
{
return 'Users_' . date('YmdHis');
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\DataTables;
use App\Models\User;
use App\Models\UsersAssingedRole;
use Illuminate\Contracts\Database\Query\Builder;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class UsersAssignedRoleDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->rawColumns(['user'])
->editColumn('user', function (User $user) {
return view('pages/apps.user-management.roles.columns._user', compact('user'));
})
->editColumn('created_at', function (User $user) {
return $user->created_at->format('d M Y, h:i a');
})
->addColumn('action', function (User $user) {
return view('pages/apps.user-management.roles.columns._actions', compact('user'));
})
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(User $model): QueryBuilder
{
return $model->newQuery()->whereHas('roles', function (Builder $query) {
$query->where('role_id', $this->role->getKey());
});
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('usersassingedrole-table')
->columns($this->getColumns())
->minifiedAjax()
->dom('rt' . "<'row'<'col-sm-12 col-md-5'l><'col-sm-12 col-md-7'p>>",)
->addTableClass('table align-middle table-row-dashed fs-6 gy-5 dataTable no-footer text-gray-600 fw-semibold')
->setTableHeadClass('text-start text-muted fw-bold fs-7 text-uppercase gs-0')
->orderBy(1)
->drawCallback("function() {" . file_get_contents(resource_path('views/pages/apps/user-management/users/columns/_draw-scripts.js')) . "}");
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('id'),
Column::make('user')->addClass('d-flex align-items-center')->name('name'),
Column::make('name'),
Column::make('created_at')->title('Joined Date')->addClass('text-nowrap'),
Column::computed('action')
->addClass('text-end text-nowrap')
->exportable(false)
->printable(false)
->width(60),
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'UsersAssingedRole_' . date('YmdHis');
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace App\DataTables;
use App\Models\User;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Services\DataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
class UsersDataTable extends DataTable
{
/**
* Build the DataTable class.
*
* @param QueryBuilder $query Results from query() method.
*/
public function dataTable(QueryBuilder $query): EloquentDataTable
{
return (new EloquentDataTable($query))
->rawColumns(['user', 'last_login_at'])
->editColumn('user', function (User $user) {
return view('pages/apps.user-management.users.columns._user', compact('user'));
})
->editColumn('role', function (User $user) {
return ucwords($user->roles->first()?->name);
})
->editColumn('last_login_at', function (User $user) {
return sprintf('<div class="badge badge-light fw-bold">%s</div>', $user->last_login_at ? $user->last_login_at->diffForHumans() : $user->updated_at->diffForHumans());
})
->editColumn('created_at', function (User $user) {
return $user->created_at->format('d M Y, h:i a');
})
->addColumn('action', function (User $user) {
return view('pages/apps.user-management.users.columns._actions', compact('user'));
})
->setRowId('id');
}
/**
* Get the query source of dataTable.
*/
public function query(User $model): QueryBuilder
{
return $model->newQuery();
}
/**
* Optional method if you want to use the html builder.
*/
public function html(): HtmlBuilder
{
return $this->builder()
->setTableId('users-table')
->columns($this->getColumns())
->minifiedAjax()
->dom('rt' . "<'row'<'col-sm-12 col-md-5'l><'col-sm-12 col-md-7'p>>",)
->addTableClass('table align-middle table-row-dashed fs-6 gy-5 dataTable no-footer text-gray-600 fw-semibold')
->setTableHeadClass('text-start text-muted fw-bold fs-7 text-uppercase gs-0')
->orderBy(2)
->drawCallback("function() {" . file_get_contents(resource_path('views/pages/apps/user-management/users/columns/_draw-scripts.js')) . "}");
}
/**
* Get the dataTable columns definition.
*/
public function getColumns(): array
{
return [
Column::make('user')->addClass('d-flex align-items-center')->name('name'),
Column::make('role')->searchable(false),
Column::make('last_login_at')->title('Last Login'),
Column::make('created_at')->title('Joined Date')->addClass('text-nowrap'),
Column::computed('action')
->addClass('text-end text-nowrap')
->exportable(false)
->printable(false)
->width(60)
];
}
/**
* Get the filename for export.
*/
protected function filename(): string
{
return 'Users_' . date('YmdHis');
}
}

View File

@ -3,6 +3,7 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
class Handler extends ExceptionHandler
@ -46,5 +47,14 @@ class Handler extends ExceptionHandler
$this->reportable(function (Throwable $e) {
//
});
$this->renderable(function (NotFoundHttpException $e, $request) {
if ($request->is('api/*')) {
return response()->json([
'message' => 'Not found.'
], 404);
}
});
}
}

View File

@ -1,5 +1,8 @@
<?php
use Modules\Cetaklabel\Entities\Cardboard;
use Modules\Usermanager\Entities\User;
if (!function_exists('theme')) {
function theme()
{
@ -128,6 +131,7 @@ if (!function_exists('setModeSwitch')) {
*/
function setModeSwitch($flag)
{
theme()->setModeSwitch($flag);
}
}
@ -140,6 +144,7 @@ if (!function_exists('isModeSwitchEnabled')) {
*/
function isModeSwitchEnabled()
{
return theme()->isModeSwitchEnabled();
}
}
@ -154,6 +159,7 @@ if (!function_exists('setModeDefault')) {
*/
function setModeDefault($mode)
{
theme()->setModeDefault($mode);
}
}
@ -166,6 +172,7 @@ if (!function_exists('getModeDefault')) {
*/
function getModeDefault()
{
return theme()->getModeDefault();
}
}
@ -180,6 +187,7 @@ if (!function_exists('setDirection')) {
*/
function setDirection($direction)
{
theme()->setDirection($direction);
}
}
@ -192,6 +200,7 @@ if (!function_exists('getDirection')) {
*/
function getDirection()
{
return theme()->getDirection();
}
}
@ -204,6 +213,7 @@ if (!function_exists('isRtlDirection')) {
*/
function isRtlDirection()
{
return theme()->isRtlDirection();
}
}
@ -218,6 +228,7 @@ if (!function_exists('extendCssFilename')) {
*/
function extendCssFilename($path)
{
return theme()->extendCssFilename($path);
}
}
@ -418,8 +429,173 @@ if (!function_exists('getIcon')) {
*
* @return string
*/
function getIcon($name, $class = '', $type = '')
function getIcon($name, $class = '', $type = '', $tag = 'span')
{
return theme()->getIcon($name, $class, $type);
return theme()->getIcon($name, $class, $type, $tag);
}
}
if (!function_exists('get_user')) {
/**
* Get icon
*
* @param $path
*
* @return string
*/
function get_user($id)
{
return User::find($id);
}
}
if (!function_exists('get_status')) {
/**
* Get icon
*
* @param $path
*
* @return string
*/
function get_status($status)
{
if ($status == 0) {
return '<span class="badge badge-light-primary">Waiting Approval</span>';
} else if ($status == 1) {
return '<span class="badge badge-light-success">Approved</span>';
} else if ($status == 3) {
return '<span class="badge badge-light-danger">Rejected</span>';
}
}
}
if (!function_exists('verify_user')) {
function verify_user($id, $passwd, $SERVER_ADDR, $IPUserManager, $portUserManager, $appId)
{
$USERMANPROG = "user_verification.php";
$sock = fsockopen("tcp://" . $IPUserManager, $portUserManager, $errno, $errstr, 30);
if (!$sock)
die("$errstr ($errno)\n");
$data = "appsid=" . urlencode($appId) . "&loginid=" . urlencode($id) . "&passwd=" . urlencode($passwd) . "&addr=" . $SERVER_ADDR . "&version=2";
//echo "data: $data <BR>";
fwrite($sock, "POST /user_verification_dev.php HTTP/1.0\r\n");
fwrite($sock, "Host: $IPUserManager\r\n");
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, "$data\r\n");
fwrite($sock, "\r\n");
$headers = "";
while ($str = trim(fgets($sock, 4096)))
$headers .= "$str\n";
$body = "";
while (!feof($sock))
$body .= fgets($sock, 4096);
fclose($sock);
return decompress($body);
}
}
if(!function_exists('getAllowableScript')) {
function getAllowableScript($sessionMenu)
{
//$sessionMenu = $_SESSION['MENU'];
if (!empty($sessionMenu)) {
$tempMenuArrayLine = explode('-', $sessionMenu);
//print_r($tempMenuArrayLine);
if (count($tempMenuArrayLine) > 0) {
foreach ($tempMenuArrayLine as $tkey => $tval) {
$tempMenuArray = explode('|', $tval);
if (count($tempMenuArray) > 0) {
foreach ($tempMenuArray as $mkey => $mval) {
[$menukey, $menuval] = explode('>', $mval);
if ($menukey === 'LINK') {
$SCRIPT_ALLOW[$menuval] = 1;
}
//$menu[$menuCounter][$menukey] = $menuval;
}
//$menuCounter++;
}
}
}
}
return $SCRIPT_ALLOW;
}
}
if(!function_exists('decompress')) {
function decompress($data)
{
$text = '';
$total = strlen($data);
for ($j = 0; $j < $total; $j = $j + 2) {
$text .= chr(hexdec(substr($data, $j, 2)));
}
return $text;
}
}
if(!function_exists('compress')) {
function compress($data)
{
$text = '';
$total = strlen($data);
for ($i = 0; $i < $total; $i++) {
$temp = dechex(ord(substr($data, $i, 1)));
if (strlen($temp) < 2) {
$temp = '0' . $temp;
}
$text .= $temp;
}
return $text;
}
}
if(!function_exists('jsonToView')) {
function jsonToView($jsonText = '')
{
$arr = json_decode($jsonText, true);
$html = "";
if ($arr && is_array($arr)) {
$html .= _arrayToHtmlTableRecursive($arr);
}
return $html;
}
}
if(!function_exists('_arrayToHtmlTableRecursive')) {
function _arrayToHtmlTableRecursive($arr)
{
$str = "<table><tbody>";
foreach ($arr as $key => $val) {
$str .= "<tr>";
$str .= "<td>$key</td>";
$str .= "<td>";
if (is_array($val)) {
if (!empty($val)) {
$str .= _arrayToHtmlTableRecursive($val);
}
} else {
$str .= "<strong>$val</strong>";
}
$str .= "</td></tr>";
}
$str .= "</tbody></table>";
return $str;
}
}
if(!function_exists('_countDocumentOnCardboard')) {
function _countDocumentOnCardboard($cardboard_id)
{
$cardboard = Cardboard::with(['cardboard_detail'])->find($cardboard_id);
$document_id = $cardboard->cardboard_detail->pluck('document_id')->toArray();
return count($document_id);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller as Controller;
class ApiController extends Controller
{
/**
* success response method.
*
* @return \Illuminate\Http\Response
*/
public function sendResponse($result, $message, $code = 200)
{
$response = [
'success' => true,
'data' => $result,
'message' => $message,
];
return response()->json($response, $code);
}
/**
* return error response.
*
* @return \Illuminate\Http\Response
*/
public function sendError($error, $errorMessages = [], $code = 404)
{
$response = [
'success' => false,
'message' => $error,
];
if (!empty($errorMessages)) {
$response['data'] = $errorMessages;
}
return response()->json($response, $code);
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers\Apps;
use App\DataTables\PermissionsDataTable;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PermissionManagementController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(PermissionsDataTable $dataTable)
{
return $dataTable->render('pages/apps.user-management.permissions.list');
}
/**
* 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)
{
//
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Http\Controllers\Apps;
use App\DataTables\UsersAssignedRoleDataTable;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
class RoleManagementController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('pages/apps.user-management.roles.list');
}
/**
* 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(Role $role, UsersAssignedRoleDataTable $dataTable)
{
return $dataTable->with('role', $role)
->render('pages/apps.user-management.roles.show', compact('role'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Role $role)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Role $role)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Role $role)
{
//
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Http\Controllers\Apps;
use App\DataTables\UsersDataTable;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
class UserManagementController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(UsersDataTable $dataTable)
{
return $dataTable->render('pages/apps.user-management.users.list');
}
/**
* 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(User $user)
{
return view('pages/apps.user-management.users.show', compact('user'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(User $user)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, User $user)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(User $user)
{
//
}
}

View File

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
class AuthenticatedSessionController extends Controller
@ -19,7 +20,7 @@ class AuthenticatedSessionController extends Controller
{
addJavascriptFile('assets/js/custom/authentication/sign-in/general.js');
return view('pages.auth.login');
return view('pages/auth.login');
}
/**
@ -35,6 +36,11 @@ class AuthenticatedSessionController extends Controller
$request->session()->regenerate();
$request->user()->update([
'last_login_at' => Carbon::now()->toDateTimeString(),
'last_login_ip' => $request->getClientIp()
]);
return redirect()->intended(RouteServiceProvider::HOME);
}

View File

@ -17,7 +17,7 @@ class ConfirmablePasswordController extends Controller
*/
public function show()
{
return view('pages.auth.confirm-password');
return view('pages/auth.confirm-password');
}
/**

View File

@ -18,6 +18,6 @@ class EmailVerificationPromptController extends Controller
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(RouteServiceProvider::HOME)
: view('pages.auth.verify-email');
: view('pages/auth.verify-email');
}
}

View File

@ -20,7 +20,9 @@ class NewPasswordController extends Controller
*/
public function create(Request $request)
{
return view('pages.auth.reset-password', ['request' => $request]);
addJavascriptFile('assets/js/custom/authentication/reset-password/new-password.js');
return view('pages/auth.reset-password', ['request' => $request]);
}
/**

View File

@ -17,7 +17,7 @@ class PasswordResetLinkController extends Controller
{
addJavascriptFile('assets/js/custom/authentication/reset-password/reset-password.js');
return view('pages.auth.forgot-password');
return view('pages/auth.forgot-password');
}
/**

View File

@ -2,14 +2,15 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Validation\Rules;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\Auth\Events\Registered;
use App\Providers\RouteServiceProvider;
class RegisteredUserController extends Controller
{
@ -22,7 +23,7 @@ class RegisteredUserController extends Controller
{
addJavascriptFile('assets/js/custom/authentication/sign-up/general.js');
return view('pages.auth.register');
return view('pages/auth.register');
}
/**
@ -45,6 +46,8 @@ class RegisteredUserController extends Controller
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
'last_login_at' => \Illuminate\Support\Carbon::now()->toDateTimeString(),
'last_login_ip' => $request->getClientIp()
]);
event(new Registered($user));

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\Verified;
use Laravel\Socialite\Facades\Socialite;
class SocialiteController extends Controller
{
public function redirect($provider)
{
// redirect from social site
if (request()->input('state')) {
// already logged in
// get user info from social site
$user = Socialite::driver($provider)->stateless()->user();
// check for existing user
$existingUser = User::where('email', $user->getEmail())->first();
if ($existingUser) {
auth()->login($existingUser, true);
return redirect()->to('/');
}
$newUser = $this->createUser($user);
auth()->login($newUser, true);
}
// request login from social site
return Socialite::driver($provider)->redirect();
}
function createUser($user)
{
$user = User::updateOrCreate([
'email' => $user->getEmail(),
], [
'name' => $user->getName(),
'password' => '',
'avatar' => $user->getAvatar(),
]);
if ($user->markEmailAsVerified()) {
event(new Verified($user));
}
return $user;
}
}

View File

@ -8,6 +8,6 @@ class DashboardController extends Controller
{
addVendors(['amcharts', 'amcharts-maps', 'amcharts-stock']);
return view('pages.dashboards.index');
return view('pages/dashboards.index');
}
}

View File

@ -1,123 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\DirectoratDataTable;
use App\Http\Requests\StoreDirectoratRequest;
use App\Http\Requests\UpdateDirectoratRequest;
use App\Models\Directorat;
use Illuminate\Http\Request;
use Spatie\Activitylog\Facades\CauserResolver;
class DirectoratController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
//CauserResolver::setCauser($this->user);
}
/**
* Display a listing of the resource.
*/
public function index(DirectoratDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
return $dataTable->render('pages.masters.directorat.index');
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreDirectoratRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the Directorat...
if($validated){
try{
Directorat::create($validated);
//return redirect()->route('directorat.index')->with('success', 'Directorat created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Directorat created successfully.']);
}catch(\Exception $e){
//return redirect()->route('directorat.index')->with('error', 'Directorat created failed.');
echo json_encode(['status' => 'error', 'message' => 'Directorat created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Directorat $directorat)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$directorat = Directorat::find($id);
echo json_encode($directorat);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateDirectoratRequest $request, Directorat $directorat)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the Directorat...
if($validated){
try{
CauserResolver::setCauser($this->user);
$directorat->update($validated);
//return redirect()->route('directorat.index')->with('success', 'Directorat updated successfully.');
echo json_encode(['status' => 'success', 'message' => 'Directorat updated successfully.']);
}catch(\Exception $e){
//return redirect()->route('directorat.index')->with('error', 'Directorat updated failed.');
echo json_encode(['status' => 'error', 'message' => 'Directorat updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Directorat $directorat){
$directorat->delete();
echo json_encode(['status' => 'success', 'message' => 'Directorat deleted successfully.']);
}
}

View File

@ -1,179 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\DocumentDataTable;
use App\Http\Requests\StoreDocumentRequest;
use App\Http\Requests\UpdateDocumentRequest;
use App\Models\Directorat;
use App\Models\Document;
use App\Models\DocumentDetail;
use App\Models\DocumentType;
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
use App\Models\SubJob;
use App\Models\SubSubJob;
use Exception;
use Illuminate\Http\Request;
use Spatie\Activitylog\Facades\CauserResolver;
class DocumentController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
//CauserResolver::setCauser($this->user);
}
/**
* Display a listing of the resource.
*/
public function index(DocumentDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('app.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
return $dataTable->render('pages.app.document.index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
/*if (is_null($this->user) || !$this->user->can('app.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
addVendor('chained-select');
$directorat = Directorat::all();
$special_code = SpecialCode::all();
$document_type = DocumentType::all();
return view('pages.app.document.create', compact('directorat', 'special_code', 'document_type'));
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreDocumentRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('app.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the Document...
if ($validated) {
$validated['sequence'] = 1;
try {
$created = Document::create($validated);
if ($created) {
$detail = [
'document_id' => $created->id,
'document_type_id' => $request->document_type_id,
'tanggal_upload' => date('Y-m-d'),
'tanggal_dokumen' => $request->tanggal_dokumen,
'nomor_dokumen' => $request->nomor_dokumen,
'perihal' => $request->perihal,
'kode_cabang' => $request->kode_cabang,
'jumlah_halaman' => $request->jumlah_halaman,
'custom_field_1' => $request->custom_field_1,
'custom_field_2' => $request->custom_field_2,
'custom_field_3' => $request->custom_field_3,
'custom_field_4' => $request->custom_field_4,
'nama_nasabah' => $request->nama_nasabah,
'no_rekening' => $request->no_rekening,
'no_cif' => $request->no_cif,
'group' => $request->group,
];
DocumentDetail::create($detail);
}
return redirect()->route('document.index')->with('success', 'Document created successfully.');
} catch (Exception $e) {
return redirect()->route('document.index')->with('error', 'Document created failed.');
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Document $documents)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$document = Document::find($id);
$directorat = Directorat::all();
$sub_directorat = SubDirectorat::where('directorat_id', $document->directorat_id)->get();
$job = Job::where('sub_directorat_id', $document->sub_directorat_id)->get();
$sub_job = SubJob::where('job_id', $document->job_id)->get();
$sub_sub_job = SubSubJob::where('sub_job_id', $document->sub_job_id)->get();
$special_code = SpecialCode::all();
$document_type = DocumentType::all();
return view('pages.app.document.edit', compact('document', 'directorat', 'sub_directorat', 'job', 'sub_job', 'sub_sub_job', 'special_code', 'document_type'));
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateDocumentRequest $request, Document $documents)
{
/*if (is_null($this->user) || !$this->user->can('app.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the Document...
if ($validated) {
try {
$document = Document::find($request->id);
$update = $document->update($validated);
return redirect()->route('document.index')->with('success', 'Document updated successfully.');
} catch (Exception $e) {
return redirect()->route('document.index')->with('error', 'Document updated failed.');
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Request $request)
{
$documents = Document::find($request->document);
$documents->delete();
echo json_encode(['status' => 'success', 'message' => 'Document deleted successfully.']);
}
}

View File

@ -1,118 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\DocumentTypeDataTable;
use App\Http\Requests\StoreDocumentTypeRequest;
use App\Http\Requests\UpdateDocumentTypeRequest;
use App\Models\DocumentType;
use Illuminate\Http\Request;
use Spatie\Activitylog\Facades\CauserResolver;
class DocumentTypeController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
//CauserResolver::setCauser($this->user);
}
/**
* Display a listing of the resource.
*/
public function index(DocumentTypeDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
return $dataTable->render('pages.masters.document-type.index');
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreDocumentTypeRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the Document Type...
if($validated){
try{
DocumentType::create($validated);
echo json_encode(['status' => 'success', 'message' => 'Document Type created successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Document Type created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(DocumentType $document_type)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$document_type = DocumentType::find($id);
echo json_encode($document_type);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateDocumentTypeRequest $request, DocumentType $document_type)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the Directorat...
if($validated){
try{
$document_type->update($validated);
echo json_encode(['status' => 'success', 'message' => 'Document Type updated successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Document Type updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(DocumentType $document_type){
$document_type->delete();
echo json_encode(['status' => 'success', 'message' => 'Document Type deleted successfully.']);
}
}

View File

@ -1,139 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\JobDataTable;
use App\Http\Requests\StoreJobRequest;
use App\Http\Requests\UpdateJobRequest;
use App\Models\Directorat;
use App\Models\Job;
use Illuminate\Http\Request;
class JobController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(JobDataTable $dataTable, Request $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
// Add Vendor
addVendor('chained-select');
if(isset($request->sub_directorat_id) && !empty($request->sub_directorat_id)) {
$this->show($request);
return;
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.job.index', compact('directorat'));
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreJobRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the Job...
if($validated){
try{
Job::create($validated);
//return redirect()->route('job.index')->with('success', 'Job created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Job created successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'Job created failed.');
echo json_encode(['status' => 'error', 'message' => 'Job created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Request $request)
{
$jobs = Job::where('sub_directorat_id', $request->sub_directorat_id)->get();
$data = [];
foreach ($jobs as $row) {
$result = [
$row->id => $row->name,
];
$data[] = $result;
}
echo json_encode($data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$job = Job::find($id);
echo json_encode($job);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateJobRequest $request, Job $job)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the Job...
if($validated){
try{
$job->update($validated);
//return redirect()->route('job.index')->with('success', 'Job updated successfully.');
echo json_encode(['status' => 'success', 'message' => 'Job updated successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'Job updated failed.');
echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Job $job){
$job->delete();
echo json_encode(['status' => 'success', 'message' => 'Job deleted successfully.']);
//return redirect()->route('job.index')->with('success', 'Job deleted successfully.');
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Http\Controllers\Logs;
use App\DataTables\Logs\AuditLogsDataTable;
use App\Http\Controllers\Controller;
use Spatie\Activitylog\Models\Activity;
class AuditLogsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(AuditLogsDataTable $dataTable)
{
return $dataTable->render('pages.log.audit.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$activity = Activity::find($id);
// Delete from db
$activity->delete();
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace App\Http\Controllers\Logs;
use App\DataTables\Logs\SystemLogsDataTable;
use App\Http\Controllers\Controller;
use Jackiedo\LogReader\LogReader;
class SystemLogsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(SystemLogsDataTable $dataTable)
{
return $dataTable->render('pages.log.system.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id, LogReader $logReader)
{
return $logReader->find($id)->delete();
}
}

View File

@ -1,118 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\SpecialCodeDataTable;
use App\Http\Requests\StoreSpecialCodeRequest;
use App\Http\Requests\UpdateSpecialCodeRequest;
use App\Models\SpecialCode;
use Illuminate\Http\Request;
use Spatie\Activitylog\Facades\CauserResolver;
class SpecialCodeController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
//CauserResolver::setCauser($this->user);
}
/**
* Display a listing of the resource.
*/
public function index(SpecialCodeDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
return $dataTable->render('pages.masters.special-code.index');
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSpecialCodeRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the Special Code...
if($validated){
try{
SpecialCode::create($validated);
echo json_encode(['status' => 'success', 'message' => 'Special Code created successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Special Code created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(SpecialCode $special_code)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$special_code = SpecialCode::find($id);
echo json_encode($special_code);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSpecialCodeRequest $request, SpecialCode $special_code)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the Directorat...
if($validated){
try{
$special_code->update($validated);
echo json_encode(['status' => 'success', 'message' => 'Special Code updated successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Special Code updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SpecialCode $special_code){
$special_code->delete();
echo json_encode(['status' => 'success', 'message' => 'Special Code deleted successfully.']);
}
}

View File

@ -1,138 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\SubDirectoratDataTable;
use App\Http\Requests\StoreSubDirectoratRequest;
use App\Http\Requests\UpdateSubDirectoratRequest;
use App\Models\Directorat;
use App\Models\SubDirectorat;
use Illuminate\Http\Request;
class SubDirectoratController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(SubDirectoratDataTable $dataTable, Request $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
if(isset($request->directorat_id) && !empty($request->directorat_id)) {
$this->show($request);
return;
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-directorat.index', compact('directorat'));
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSubDirectoratRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the SubDirectorat...
if($validated){
try{
SubDirectorat::create($validated);
//return redirect()->route('directorat.index')->with('success', 'SubDirectorat created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat created successfully.']);
}catch(\Exception $e){
//return redirect()->route('directorat.index')->with('error', 'SubDirectorat created failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Request $request)
{
$subdirectorats = SubDirectorat::where('directorat_id', $request->directorat_id)->get();
$data = [];
foreach ($subdirectorats as $row) {
$result = [
$row->id => $row->name,
];
$data[] = $result;
}
echo json_encode($data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$subDirectorat = SubDirectorat::find($id);
echo json_encode($subDirectorat);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSubDirectoratRequest $request, SubDirectorat $subDirectorat)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the SubDirectorat...
if($validated){
try{
$subDirectorat->update($validated);
//return redirect()->route('directorat.index')->with('success', 'SubDirectorat updated successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat updated successfully.']);
}catch(\Exception $e){
//return redirect()->route('directorat.index')->with('error', 'SubDirectorat updated failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SubDirectorat $subDirectorat){
$subDirectorat->delete();
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat deleted successfully.']);
//return redirect()->route('sub-directorat.index')->with('success', 'Sub Directorat deleted successfully.');
}
}

View File

@ -1,139 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\SubJobDataTable;
use App\Http\Requests\StoreSubJobRequest;
use App\Http\Requests\UpdateSubJobRequest;
use App\Models\Directorat;
use App\Models\Job;
use App\Models\SubJob;
use Illuminate\Http\Request;
class SubJobController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(SubJobDataTable $dataTable, Request $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
addVendor('chained-select');
if(isset($request->job_id) && !empty($request->job_id)) {
$this->show($request);
return;
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-job.index', compact('directorat'));
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSubJobRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the SubJob...
if($validated){
try{
SubJob::create($validated);
//return redirect()->route('job.index')->with('success', 'SubJob created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Job created successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'SubJob created failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Request $request)
{
$subJob = SubJob::where('job_id', $request->job_id)->get();
$data = [];
foreach ($subJob as $row) {
$result = [
$row->id => $row->name,
];
$data[] = $result;
}
echo json_encode($data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$subJob = SubJob::find($id);
echo json_encode($subJob);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSubJobRequest $request, SubJob $subJob)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the SubJob...
if($validated){
try{
$subJob->update($validated);
//return redirect()->route('job.index')->with('success', 'SubJob updated successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Job updated successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'SubJob updated failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SubJob $subJob){
$subJob->delete();
echo json_encode(['status' => 'success', 'message' => 'Sub Job deleted successfully.']);
//return redirect()->route('sub-job.index')->with('success', 'Sub Job deleted successfully.');
}
}

View File

@ -1,139 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\DataTables\SubSubJobDataTable;
use App\Http\Requests\StoreSubSubJobRequest;
use App\Http\Requests\UpdateSubSubJobRequest;
use App\Models\Directorat;
use App\Models\Job;
use App\Models\SubSubJob;
use Illuminate\Http\Request;
class SubSubJobController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(SubSubJobDataTable $dataTable, Request $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
if(isset($request->sub_job_id) && !empty($request->sub_job_id)) {
$this->show($request);
return;
}
addVendor('chained-select');
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-sub-job.index', compact('directorat'));
}
/**
* Show the form for creating a new resource.
*/
public function create(){}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSubSubJobRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Store the SubSubJob...
if($validated){
try{
SubSubJob::create($validated);
//return redirect()->route('job.index')->with('success', 'SubSubJob created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job created successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'SubSubJob created failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*/
public function show(Request $request)
{
$subSubJob = SubSubJob::where('sub_job_id', $request->sub_job_id)->get();
$data = [];
foreach ($subSubJob as $row) {
$result = [
$row->id => $row->name,
];
$data[] = $result;
}
echo json_encode($data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id){
$subJob = SubSubJob::find($id);
echo json_encode($subJob);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSubSubJobRequest $request, SubSubJob $subSubJob)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
// Validate the request...
$validated = $request->validated();
// Update the SubSubJob...
if($validated){
try{
$subSubJob->update($validated);
//return redirect()->route('job.index')->with('success', 'SubSubJob updated successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job updated successfully.']);
}catch(\Exception $e){
//return redirect()->route('job.index')->with('error', 'SubSubJob updated failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SubSubJob $subSubJob){
$subSubJob->delete();
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job deleted successfully.']);
//return redirect()->route('sub-job.index')->with('success', 'Sub Sub Job deleted successfully.');
}
}

View File

@ -1,205 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\PermissionsDataTable;
use App\Http\Controllers\Controller;
use App\Models\PermissionGroup;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\Permission;
class PermissionsController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(PermissionsDataTable $dataTable)
{
/* if (is_null($this->user) || !$this->user->can('permission.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any permission !');
}*/
return $dataTable->render('pages.users.permissions.index');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
/*if (is_null($this->user) || !$this->user->can('permission.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any permission !');
}*/
// Validation Data
$validate = $request->validate([
'name' => 'required|max:100|unique:permission_groups'
], [
'name.requried' => 'Please give a permission name'
]);
if($validate){
try{
// Process Data
$group = PermissionGroup::create(['name' => $request->name]);
$group_name = strtolower($request->name);
$data = [
$group_name.'.create',
$group_name.'.read',
$group_name.'.update',
$group_name.'.delete',
$group_name.'.authorize',
$group_name.'.report'
];
foreach($data as $permission){
Permission::create([
'name' => $permission,
'guard_name' => 'web',
'permission_group_id' => $group->id
]);
}
echo json_encode(['status' => 'success', 'message' => 'Permission created successfully.']);
}catch(\Exception $e){
echo json_encode(['status' => 'error', 'message' => 'Permission created failed.']);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
/*if (is_null($this->user) || !$this->user->can('permission.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any permission !');
}*/
$permission = PermissionGroup::find($id);
echo json_encode($permission);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('permission.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any permission !');
}*/
// Validation Data
$validated = $request->validate([
'name' => 'required|max:100|unique:permission_groups,name,' . $id
], [
'name.requried' => 'Please give a permission name'
]);
if ($validated) {
try {
// Process Data
$group = PermissionGroup::find($id);
$group->name = $request->name;
if($group->save()){
$group_name = strtolower($request->name);
$permissions = Permission::where('permission_group_id', $group->id)->get();
$data = [
$group_name . '.create',
$group_name . '.read',
$group_name . '.update',
$group_name . '.delete',
$group_name . '.authorize',
$group_name . '.report'
];
$i = 0;
foreach($permissions as $permission){
$permission->name = $data[$i];
$permission->save();
$i++;
}
}
echo json_encode(['status' => 'success', 'message' => 'Permission updated successfully.']);
} catch (\Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Permission updated failed.']);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
/*if (is_null($this->user) || !$this->user->can('permission.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any role !');
}*/
$permission = PermissionGroup::find($id);
if (!is_null($permission)) {
if($permission->delete()){
Permission::where('permission_group_id',$id)->delete();
}
}
echo json_encode(['status' => 'success', 'message' => 'Permission deleted successfully.']);
}
}

View File

@ -1,190 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\RolesDataTable;
use App\Http\Controllers\Controller;
use App\Models\PermissionGroup;
use App\Models\User;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Role;
use App\Models\Permission;
class RolesController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(RolesDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('role.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any role !');
}*/
$permissiongroups = PermissionGroup::all();
return $dataTable->render('pages.users.roles.index', compact('permissiongroups'));
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function store(Request $request)
{
/*if (is_null($this->user) || !$this->user->can('role.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any role !');
}*/
// Validation Data
$validated = $request->validate([
'name' => 'required|max:100|unique:roles'
], [
'name.requried' => 'Please give a role name'
]);
if ($validated) {
try {
// Process Data
$role = Role::create(['name' => $request->name, 'guard_name' => 'web']);
$permissions = $request->input('permissions');
if (!empty($permissions)) {
$role = Role::find($role->id);
$role->syncPermissions($permissions);
}
echo json_encode(['status' => 'success', 'message' => 'Role Created Successfully']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Role Created Failed']);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
/* if (is_null($this->user) || !$this->user->can('role.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
}*/
$role = Role::findById($id, 'web');
$permissions = Permission::all();
$permissiongroups = PermissionGroup::all();
$_array = [
'role' => $role,
'permissions' => $permissions,
'permissiongroups' => $permissiongroups
];
return view('pages.users.roles.edit', $_array);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
*
* @return Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('role.update')) {
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
}*/
// Validation Data
$request->validate([
'name' => 'required|max:100|unique:roles,name,' . $id
], [
'name.requried' => 'Please give a role name'
]);
$role = Role::findById($id, 'web');
$permissions = $request->input('permissions');
$role->name = $request->name;
$role->save();
if (!empty($permissions)) {
$role->syncPermissions($permissions);
}
session()->flash('success', 'Role has been updated !!');
return redirect()->route('user.roles.index');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy($id)
{
/*if (is_null($this->user) || !$this->user->can('role.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any role !');
}*/
$role = Role::findById($id, 'web');
if (!is_null($role)) {
$role->delete();
}
session()->flash('success', 'Role has been deleted !!');
return redirect()->route('user.roles.index');
}
}

View File

@ -1,238 +0,0 @@
<?php
namespace App\Http\Controllers\Users;
use App\DataTables\Users\UsersDataTable;
use App\Models\Directorat;
use App\Models\User;
use App\Http\Controllers\Controller;
use App\Models\UserInfo;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\Permission;
use Spatie\Permission\Models\Role;
class UsersController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(UsersDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('user.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any users !');
}*/
addVendor('chained-select');
$directorat = Directorat::all();
$roles = Role::all();
return $dataTable->render('pages.users.users.index', compact('directorat', 'roles'));
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
/* if (is_null($this->user) || !$this->user->can('user.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any users !');
}*/
$roles = Role::all();
return view('pages.users.create', compact('roles'));
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function store(Request $request)
{
/* if (is_null($this->user) || !$this->user->can('user.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any users !');
}*/
// Validation Data
$request->password = 'bagbag';
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users'
]);
if ($validated) {
try {
// Create New User
$user = new User();
$user->name = $request->name;
$user->email = $request->email;
$user->directorat_id = $request->directorat_id;
$user->sub_directorat_id = $request->sub_directorat_id;
$user->password = Hash::make($request->password);
$user->save();
if ($request->roles) {
$user->assignRole($request->roles);
}
echo json_encode([
'status' => 'success',
'message' => 'User Created Successfully'
]);
} catch (Exception $e) {
echo json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
}
}
return false;
}
/**
* Display the specified resource.
*
* @param int $id
*
* @return Response
*/
public function show($id)
{
/*if (is_null($this->user) || !$this->user->can('user.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any users !');
}*/
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
/*if (is_null($this->user) || !$this->user->can('user.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any users !');
}*/
$user = User::find($id);
$roles = $user->roles;
echo json_encode([
'status' => 'success',
'data' => $user,
'roles' => $roles
]);
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
*
* @return Response
*/
public function update(Request $request, $id)
{
/* if (is_null($this->user) || !$this->user->can('user.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any users !');
}*/
// Create New User
$user = User::find($id);
// Validation Data
if ($request->password !== '') {
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users,email,' . $id,
'password' => 'nullable|min:6|confirmed'
]);
} else {
$validated = $request->validate([
'name' => 'required|max:50',
'email' => 'required|max:100|email|unique:users,email,' . $id
]);
}
if ($validated) {
try {
$user->name = $request->name;
$user->email = $request->email;
$user->directorat_id = $request->directorat_id;
$user->sub_directorat_id = $request->sub_directorat_id;
if ($request->password) {
$user->password = Hash::make($request->password);
}
$user->save();
$user->roles()->detach();
if ($request->roles) {
$user->assignRole($request->roles);
}
echo json_encode([
'status' => 'success',
'message' => 'User Updated Successfully'
]);
} catch (Exception $e) {
echo json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
}
}
return false;
}
/**
* Remove the specified resource from storage.
*
* @param int $id
*
* @return Response
*/
public function destroy(User $user)
{
/*if (is_null($this->user) || !$this->user->can('user.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any users !');
}*/
$user->delete();
echo json_encode([
'status' => 'success',
'message' => 'User Deleted Successfully'
]);
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Http\Livewire\Permission;
use Livewire\Component;
use Spatie\Permission\Models\Permission;
class PermissionModal extends Component
{
public $name;
public Permission $permission;
protected $rules = [
'name' => 'required|string',
];
// This is the list of listeners that this component listens to.
protected $listeners = [
'modal.show.permission_name' => 'mountPermission',
'delete_permission' => 'delete'
];
public function render()
{
return view('livewire.permission.permission-modal');
}
public function mountPermission($permission_name = '')
{
if (empty($permission_name)) {
// Create new
$this->permission = new Permission;
$this->name = '';
return;
}
// Get the role by name.
$permission = Permission::where('name', $permission_name)->first();
if (is_null($permission)) {
$this->emit('error', 'The selected permission [' . $permission_name . '] is not found');
return;
}
$this->permission = $permission;
// Set the name and checked permissions properties to the role's values.
$this->name = $this->permission->name;
}
public function submit()
{
$this->validate();
$this->permission->name = strtolower($this->name);
if ($this->permission->isDirty()) {
$this->permission->save();
}
// Emit a success event with a message indicating that the permissions have been updated.
$this->emit('success', 'Permission updated');
}
public function delete($name)
{
$permission = Permission::where('name', $name)->first();
if (!is_null($permission)) {
$permission->delete();
}
$this->emit('success', 'Permission deleted');
}
public function hydrate()
{
$this->resetErrorBag();
$this->resetValidation();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Livewire\Permission;
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component;
use Spatie\Permission\Models\Role;
class RoleList extends Component
{
public array|Collection $roles;
protected $listeners = ['success' => 'updateRoleList'];
public function render()
{
$this->roles = Role::with('permissions')->get();
return view('livewire.permission.role-list');
}
public function updateRoleList()
{
$this->roles = Role::with('permissions')->get();
}
public function hydrate()
{
$this->resetErrorBag();
$this->resetValidation();
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace App\Http\Livewire\Permission;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Str;
use Livewire\Component;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
class RoleModal extends Component
{
public $name;
public $checked_permissions;
public $check_all;
public Role $role;
public Collection $permissions;
protected $rules = [
'name' => 'required|string',
];
// This is the list of listeners that this component listens to.
protected $listeners = ['modal.show.role_name' => 'mountRole'];
// This function is called when the component receives the `modal.show.role_name` event.
public function mountRole($role_name = '')
{
if (empty($role_name)) {
// Create new
$this->role = new Role;
$this->name = '';
return;
}
// Get the role by name.
$role = Role::where('name', $role_name)->first();
if (is_null($role)) {
$this->emit('error', 'The selected role [' . $role_name . '] is not found');
return;
}
$this->role = $role;
// Set the name and checked permissions properties to the role's values.
$this->name = $this->role->name;
$this->checked_permissions = $this->role->permissions->pluck('name');
}
// This function is called when the component is mounted.
public function mount()
{
// Get all permissions.
$this->permissions = Permission::all();
// Set the checked permissions property to an empty array.
$this->checked_permissions = [];
}
// This function renders the component's view.
public function render()
{
// Create an array of permissions grouped by ability.
$permissions_by_group = [];
foreach ($this->permissions ?? [] as $permission) {
$ability = Str::after($permission->name, ' ');
$permissions_by_group[$ability][] = $permission;
}
// Return the view with the permissions_by_group variable passed in.
return view('livewire.permission.role-modal', compact('permissions_by_group'));
}
// This function submits the form and updates the role's permissions.
public function submit()
{
$this->validate();
$this->role->name = $this->name;
if ($this->role->isDirty()) {
$this->role->save();
}
// Sync the role's permissions with the checked permissions property.
$this->role->syncPermissions($this->checked_permissions);
// Emit a success event with a message indicating that the permissions have been updated.
$this->emit('success', 'Permissions for ' . ucwords($this->role->name) . ' role updated');
}
// This function checks all of the permissions.
public function checkAll()
{
// If the check_all property is true, set the checked permissions property to all of the permissions.
if ($this->check_all) {
$this->checked_permissions = $this->permissions->pluck('name');
} else {
// Otherwise, set the checked permissions property to an empty array.
$this->checked_permissions = [];
}
}
public function hydrate()
{
$this->resetErrorBag();
$this->resetValidation();
}
}

View File

@ -0,0 +1,145 @@
<?php
namespace App\Http\Livewire\User;
use App\Models\User;
use Livewire\Component;
use Livewire\WithFileUploads;
use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Role;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
class AddUserModal extends Component
{
use WithFileUploads;
public $user_id;
public $name;
public $email;
public $role;
public $avatar;
public $saved_avatar;
public $edit_mode = false;
protected $rules = [
'name' => 'required|string',
'email' => 'required|email',
'role' => 'required|string',
'avatar' => 'nullable|sometimes|image|max:1024',
];
protected $listeners = [
'delete_user' => 'deleteUser',
'update_user' => 'updateUser',
];
public function render()
{
$roles = Role::all();
$roles_description = [
'administrator' => 'Best for business owners and company administrators',
'developer' => 'Best for developers or people primarily using the API',
'analyst' => 'Best for people who need full access to analytics data, but don\'t need to update business settings',
'support' => 'Best for employees who regularly refund payments and respond to disputes',
'trial' => 'Best for people who need to preview content data, but don\'t need to make any updates',
];
foreach ($roles as $i => $role) {
$roles[$i]->description = $roles_description[$role->name] ?? '';
}
return view('livewire.user.add-user-modal', compact('roles'));
}
public function submit()
{
// Validate the form input data
$this->validate();
DB::transaction(function () {
// Prepare the data for creating a new user
$data = [
'name' => $this->name,
];
if ($this->avatar) {
$data['profile_photo_path'] = $this->avatar->store('avatars', 'public');
} else {
$data['profile_photo_path'] = null;
}
if (!$this->edit_mode) {
$data['password'] = Hash::make($this->email);
}
// Create a new user record in the database
$user = $this->user_id ? User::find($this->user_id) : User::updateOrCreate([
'email' => $this->email,
], $data);
if ($this->edit_mode) {
foreach ($data as $k => $v) {
$user->$k = $v;
}
}
if ($this->edit_mode) {
// Assign selected role for user
$user->syncRoles($this->role);
// Emit a success event with a message
$this->emit('success', __('User updated'));
} else {
// Assign selected role for user
$user->assignRole($this->role);
// Send a password reset link to the user's email
Password::sendResetLink($user->only('email'));
// Emit a success event with a message
$this->emit('success', __('New user created'));
}
});
// Reset the form fields after successful submission
$this->reset();
}
public function deleteUser($id)
{
// Prevent deletion of current user
if ($id == Auth::id()) {
$this->emit('error', 'User cannot be deleted');
return;
}
// Delete the user record with the specified ID
User::destroy($id);
// Emit a success event with a message
$this->emit('success', 'User successfully deleted');
}
public function updateUser($id)
{
$this->edit_mode = true;
$user = User::find($id);
$this->user_id = $user->id;
$this->saved_avatar = $user->profile_photo_url;
$this->name = $user->name;
$this->email = $user->email;
$this->role = $user->roles?->first()->name ?? '';
}
public function hydrate()
{
$this->resetErrorBag();
$this->resetValidation();
}
}

View File

@ -13,5 +13,6 @@ class VerifyCsrfToken extends Middleware
*/
protected $except = [
//
'login'
];
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:directorats,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('directorat.index')->with('error', 'Directorat created failed.');
}
});
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
{
return [
'kode' => 'required|string|unique:documents,kode',
'directorat_id' => 'required|integer|exists:directorats,id',
'sub_directorat_id' => 'required|integer|exists:sub_directorats,id',
'job_id' => 'required|integer|exists:jobs,id',
'sub_job_id' => 'required|integer|exists:sub_jobs,id',
'sub_sub_job_id' => 'required|integer|exists:sub_sub_jobs,id',
'special_code_id' => 'nullable|integer|exists:special_codes,id',
'no_urut' => 'nullable|integer|min:1|max:999',
'sequence' => 'nullable|integer|min:1|max:999',
'status' => 'nullable|integer',
'keterangan' => 'nullable|string|max:255',
'jenis_dokumen' => 'nullable|string|max:255',
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash($value[0]);
}
return redirect()->route('document.index')->with('error', 'Document created failed.');
}
});
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreDocumentTypeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:document_types,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('document-type.index')->with('error', 'Document Type created failed.');
}
});
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'kode' => 'required|string|max:2|min:2|unique:jobs,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('job.index')->with('error', 'Job created failed.');
}
});
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreSpecialCodeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:special_codes,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('special-code.index')->with('error', 'Special Code created failed.');
}
});
}
}

View File

@ -1,48 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreSubDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required',
'kode' => 'required|string|max:2|min:2|unique:sub_directorats',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('sub-directorat.index')->with('error', 'Sub Directorat created failed.');
}
});
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'job_id' => 'required|exists:jobs,id',
'kode' => 'required|string|max:2|min:2|unique:sub_jobs,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('job.index')->with('error', 'Sub Job created failed.');
}
});
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreSubSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'job_id' => 'required|exists:jobs,id',
'sub_job_id' => 'required|exists:sub_jobs,id',
'kode' => 'required|string|max:2|min:2|unique:sub_sub_jobs,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash($value[0]);
}
return redirect()->route('job.index')->with('error', 'Sub Sub Job created failed.');
}
});
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:directorats,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('directorat.index')->with('error', 'Directorat updated failed.');
}
});
}
}

View File

@ -1,60 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
{
return [
'kode' => 'required|string|unique:documents,kode,' . $this->id,
'directorat_id' => 'required|integer|exists:directorats,id',
'sub_directorat_id' => 'required|integer|exists:sub_directorats,id',
'job_id' => 'required|integer|exists:jobs,id',
'sub_job_id' => 'required|integer|exists:sub_jobs,id',
'sub_sub_job_id' => 'required|integer|exists:sub_sub_jobs,id',
'special_code_id' => 'nullable|integer|exists:special_codes,id',
'no_urut' => 'nullable|integer|min:1|max:999',
'sequence' => 'nullable|integer|min:1|max:999',
'status' => 'nullable|integer',
'keterangan' => 'nullable|string|max:255',
'jenis_dokumen' => 'nullable|string|max:255',
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash($value[0]);
}
return redirect()->route('document.index')->with('error', 'Document updated failed.');
}
});
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateDocumentTypeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:document_types,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('document-type.index')->with('error', 'Document Type updated failed.');
}
});
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'kode' => 'required|string|max:2|min:2|unique:jobs,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('jobs.index')->with('error', 'Job updated failed.');
}
});
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateSpecialCodeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:special_codes,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('special-code.index')->with('error', 'Special Code updated failed.');
}
});
}
}

View File

@ -1,48 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateSubDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'kode' => 'required|string|max:2|min:2|unique:sub_directorats,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('sub-directorat.index')->with('error', 'Sub Directorat updated failed.');
}
});
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'job_id' => 'required|exists:jobs,id',
'kode' => 'required|string|max:2|min:2|unique:sub_jobs,kode,'.$this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash( $value[0]);
}
return redirect()->route('jobs.index')->with('error', 'Sub Job updated failed.');
}
});
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class UpdateSubSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'job_id' => 'required|exists:jobs,id',
'sub_job_id' => 'required|exists:sub_jobs,id',
'kode' => 'required|string|max:2|min:2|unique:sub_sub_jobs,kode,' . $this->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
foreach ($error as $key => $value) {
flash($value[0]);
}
return redirect()->route('jobs.index')->with('error', 'Sub Sub Job updated failed.');
}
});
}
}

11
app/Models/Address.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
use HasFactory;
}

View File

@ -1,31 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class Directorat extends Model
{
use LogsActivity, HasFactory, SoftDeletes, Userstamps;
protected $fillable = [
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function subDirectorat()
{
return $this->hasMany(SubDirectorat::class);
}
}

View File

@ -1,69 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class Document extends Model
{
use LogsActivity, HasFactory, SoftDeletes, Userstamps;
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'sub_job_id',
'sub_sub_job_id',
'special_code_id',
'no_urut',
'kode',
'sequence',
'jenis_dokumen'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function directorat()
{
return $this->belongsTo(Directorat::class);
}
public function sub_directorat()
{
return $this->belongsTo(SubDirectorat::class);
}
public function job()
{
return $this->belongsTo(Job::class);
}
public function sub_job()
{
return $this->belongsTo(SubJob::class);
}
public function sub_sub_job()
{
return $this->belongsTo(SubSubJob::class);
}
public function special_code()
{
return $this->belongsTo(SpecialCode::class);
}
public function document_details()
{
return $this->hasMany(DocumentDetail::class);
}
}

View File

@ -1,44 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class DocumentDetail extends Model
{
use LogsActivity, HasFactory, SoftDeletes, Userstamps;
protected $fillable = [
'document_id',
'document_type_id',
'nama_nasabah',
'no_rekening',
'no_cif',
'group',
'group',
'tanggal_upload',
'tanggal_dokumen',
'nomor_dokumen',
'perihal',
'kode_cabang',
'jumlah_halaman',
'custom_field_1',
'custom_field_2',
'custom_field_3',
'custom_field_4'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class DocumentType extends Model
{
use LogsActivity, HasFactory, SoftDeletes, Userstamps;
protected $fillable = [
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Job extends Model
{
use LogsActivity, HasFactory, SoftDeletes;
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('system');
}
public function directorat()
{
return $this->belongsTo(Directorat::class);
}
public function subDirectorat()
{
return $this->belongsTo(SubDirectorat::class);
}
public function subJob()
{
return $this->hasMany(SubJob::class);
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Permission as SpatiePermission;
class Permission extends SpatiePermission
{
use LogsActivity;
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function group()
{
return $this->hasOne(PermissionGroup::class);
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Role;
class PermissionGroup extends Model
{
use LogsActivity;
protected $fillable = [
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
public function permission(){
return $this->hasMany(Permission::class);
}
public function roles($group){
$permission = Permission::where('permission_group_id', $group->id)->first();
$data = [];
$roles = Role::all();
foreach($roles as $role){
if($role->hasPermissionTo($permission->name)){
array_push($data,$role);
}
}
return $data;
}
public static function getpermissionsByGroupId($id)
{
$permissions = DB::table('permissions')
->select('name', 'id')
->where('permission_group_id', $id)
->get();
return $permissions;
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Wildside\Userstamps\Userstamps;
class SpecialCode extends Model
{
use LogsActivity, HasFactory, SoftDeletes, Userstamps;
protected $fillable = [
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('master data');
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class SubDirectorat extends Model
{
use LogsActivity, HasFactory, SoftDeletes;
protected $fillable = [
'directorat_id',
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('system');
}
public function directorat()
{
return $this->belongsTo(Directorat::class);
}
public function subJobs()
{
return $this->hasMany(SubJob::class);
}
public function jobs()
{
return $this->hasManyThrough(Job::class, SubJob::class);
}
}

View File

@ -1,48 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class SubJob extends Model
{
use LogsActivity, HasFactory, SoftDeletes;
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('system');
}
public function directorat()
{
return $this->belongsTo(Directorat::class);
}
public function subDirectorat()
{
return $this->belongsTo(SubDirectorat::class);
}
public function job()
{
return $this->belongsTo(Job::class);
}
public function subSubJob()
{
return $this->hasMany(SubSubJob::class);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace App\Models;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class SubSubJob extends Model
{
use LogsActivity, HasFactory, SoftDeletes;
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'sub_job_id',
'kode',
'name'
];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logAll()
->useLogName('system');
}
public function directorat()
{
return $this->belongsTo(Directorat::class);
}
public function subDirectorat()
{
return $this->belongsTo(SubDirectorat::class);
}
public function job()
{
return $this->belongsTo(Job::class);
}
public function subJob()
{
return $this->belongsTo(SubJob::class);
}
}

View File

@ -2,17 +2,16 @@
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Wildside\Userstamps\Userstamps;
class User extends Authenticatable
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens, HasFactory, Notifiable, Userstamps;
use HasApiTokens, HasFactory, Notifiable;
use HasRoles;
/**
@ -24,8 +23,9 @@ class User extends Authenticatable
'name',
'email',
'password',
'directorat_id',
'sub_directorat_id',
'last_login_at',
'last_login_ip',
'profile_photo_path',
];
/**
@ -45,5 +45,25 @@ class User extends Authenticatable
*/
protected $casts = [
'email_verified_at' => 'datetime',
'last_login_at' => 'datetime',
];
public function getProfilePhotoUrlAttribute()
{
if ($this->profile_photo_path) {
return asset('storage/' . $this->profile_photo_path);
}
return $this->profile_photo_path;
}
public function addresses()
{
return $this->hasMany(Address::class);
}
public function getDefaultAddressAttribute()
{
return $this->addresses?->first();
}
}

View File

@ -2,6 +2,7 @@
namespace App\Providers;
use App\Core\KTBootstrap;
use Illuminate\Database\Schema\Builder;
use Illuminate\Support\ServiceProvider;
@ -26,5 +27,7 @@ class AppServiceProvider extends ServiceProvider
{
// Update defaultStringLength
Builder::defaultStringLength(191);
KTBootstrap::init();
}
}

View File

@ -2,19 +2,37 @@
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"version": "8.2.2",
"require": {
"php": "^8.0.2",
"anlutro/l4-settings": "^1.3",
"deployer/deployer": "^7.0",
"diglactic/laravel-breadcrumbs": "^8.1",
"dompdf/dompdf": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"haruncpi/laravel-id-generator": "^1.1",
"jackiedo/log-reader": "2.*",
"joshbrw/laravel-module-installer": "^2.0",
"laracasts/flash": "^3.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.0",
"laravel/octane": "^1.5",
"laravel/sanctum": "^3.2",
"laravel/socialite": "^5.6",
"laravel/tinker": "^2.7",
"laravelcollective/html": "^6.4",
"laravolt/avatar": "^5.0",
"livewire/livewire": "^3.0",
"mhmiton/laravel-modules-livewire": "^2.1",
"nwidart/laravel-modules": "^10.0",
"pharaonic/livewire-select2": "^1.2",
"putrakuningan/logs-module": "dev-master",
"putrakuningan/usermanager-module": "dev-sit",
"simplesoftwareio/simple-qrcode": "^4.2",
"spatie/laravel-activitylog": "^4.7",
"spatie/laravel-permission": "^5.10",
"wildside/userstamps": "^2.3",
@ -30,6 +48,7 @@
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
@ -40,13 +59,15 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
"Tests\\": "tests/",
"Modules\\": "Modules/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
"@php artisan package:discover --ansi",
"@php artisan vendor:publish --force --tag=livewire:assets --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
@ -68,9 +89,27 @@
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
"pestphp/pest-plugin": true,
"joshbrw/laravel-module-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"repositories": [
{
"name": "putrakuningan/logs-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/Logs"
},
{
"name": "putrakuningan/usermanager-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/Usermanager"
},
{
"name": "putrakuningan/writeoff-module",
"type": "vcs",
"url": "https://git.putrakuningan.com/putrakuningan/Writeoff"
}
]
}

9653
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,7 @@ return [
|
*/
'locale' => 'en',
'locale' => 'id',
/*
|--------------------------------------------------------------------------
@ -181,6 +181,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
@ -197,7 +198,6 @@ return [
Yajra\DataTables\DataTablesServiceProvider::class,
Jackiedo\LogReader\LogReaderServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,
],

View File

@ -62,7 +62,7 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
'model' => \Modules\Usermanager\Entities\User::class,
],
// 'users' => [

75
config/breadcrumbs.php Normal file
View File

@ -0,0 +1,75 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Name
|--------------------------------------------------------------------------
|
| Choose a view to display when Breadcrumbs::render() is called.
| Built in templates are:
|
| - 'breadcrumbs::bootstrap5' - Bootstrap 5
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
| - 'breadcrumbs::bulma' - Bulma
| - 'breadcrumbs::foundation6' - Foundation 6
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
| - 'breadcrumbs::materialize' - Materialize
| - 'breadcrumbs::tailwind' - Tailwind CSS
| - 'breadcrumbs::uikit' - UIkit
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
*/
'view' => 'breadcrumbs::bootstrap5',
/*
|--------------------------------------------------------------------------
| Breadcrumbs File(s)
|--------------------------------------------------------------------------
|
| The file(s) where breadcrumbs are defined. e.g.
|
| - base_path('routes/breadcrumbs.php')
| - glob(base_path('breadcrumbs/*.php'))
|
*/
'files' => base_path('routes/breadcrumbs.php'),
/*
|--------------------------------------------------------------------------
| Exceptions
|--------------------------------------------------------------------------
|
| Determine when to throw an exception.
|
*/
// When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
'unnamed-route-exception' => true,
// When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException)
'missing-route-bound-breadcrumb-exception' => true,
// When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException)
'invalid-named-breadcrumb-exception' => true,
/*
|--------------------------------------------------------------------------
| Classes
|--------------------------------------------------------------------------
|
| Subclass the default classes for more advanced customisations.
|
*/
// Manager
'manager-class' => Diglactic\Breadcrumbs\Manager::class,
// Generator
'generator-class' => Diglactic\Breadcrumbs\Generator::class,
];

View File

@ -0,0 +1,129 @@
<?php
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
return [
/*
|--------------------------------------------------------------------------
| Method
|--------------------------------------------------------------------------
|
| Method to use to iterate with the query results.
| Options: lazy, cursor
|
| @link https://laravel.com/docs/eloquent#cursors
| @link https://laravel.com/docs/eloquent#chunking-using-lazy-collections
|
*/
'method' => 'lazy',
/*
|--------------------------------------------------------------------------
| Chunk Size
|--------------------------------------------------------------------------
|
| Chunk size to be used when using lazy method.
|
*/
'chunk' => 1000,
/*
|--------------------------------------------------------------------------
| Export filesystem disk
|--------------------------------------------------------------------------
|
| Export filesystem disk where generated files will be stored.
|
*/
'disk' => 'local',
/*
|--------------------------------------------------------------------------
| Use S3 for final file destination
|--------------------------------------------------------------------------
|
| After generating the file locally, it can be uploaded to s3.
|
*/
's3_disk' => '',
/*
|--------------------------------------------------------------------------
| Mail from address
|--------------------------------------------------------------------------
|
| Will be used to email report from this address.
|
*/
'mail_from' => env('MAIL_FROM_ADDRESS', ''),
/*
|--------------------------------------------------------------------------
| Default Date Format
|--------------------------------------------------------------------------
|
| Default export format for date.
|
*/
'default_date_format' => 'yyyy-mm-dd',
/*
|--------------------------------------------------------------------------
| Valid Date Formats
|--------------------------------------------------------------------------
|
| List of valid date formats to be used for auto-detection.
|
*/
'date_formats' => [
'mm/dd/yyyy',
NumberFormat::FORMAT_DATE_DATETIME,
NumberFormat::FORMAT_DATE_YYYYMMDD,
NumberFormat::FORMAT_DATE_XLSX22,
NumberFormat::FORMAT_DATE_DDMMYYYY,
NumberFormat::FORMAT_DATE_DMMINUS,
NumberFormat::FORMAT_DATE_DMYMINUS,
NumberFormat::FORMAT_DATE_DMYSLASH,
NumberFormat::FORMAT_DATE_MYMINUS,
NumberFormat::FORMAT_DATE_TIME1,
NumberFormat::FORMAT_DATE_TIME2,
NumberFormat::FORMAT_DATE_TIME3,
NumberFormat::FORMAT_DATE_TIME4,
NumberFormat::FORMAT_DATE_TIME5,
NumberFormat::FORMAT_DATE_TIME6,
NumberFormat::FORMAT_DATE_TIME7,
NumberFormat::FORMAT_DATE_XLSX14,
NumberFormat::FORMAT_DATE_XLSX15,
NumberFormat::FORMAT_DATE_XLSX16,
NumberFormat::FORMAT_DATE_XLSX17,
NumberFormat::FORMAT_DATE_YYYYMMDD2,
NumberFormat::FORMAT_DATE_YYYYMMDDSLASH,
],
/*
|--------------------------------------------------------------------------
| Valid Text Formats
|--------------------------------------------------------------------------
|
| List of valid text formats to be used.
|
*/
'text_formats' => [
'@',
NumberFormat::FORMAT_GENERAL,
NumberFormat::FORMAT_TEXT,
],
/*
|--------------------------------------------------------------------------
| Purge Options
|--------------------------------------------------------------------------
|
| Purge all exported by purge.days old files.
|
*/
'purge' => [
'days' => 1,
],
];

158
config/livewire.php Normal file
View File

@ -0,0 +1,158 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Class Namespace
|--------------------------------------------------------------------------
|
| This value sets the root namespace for Livewire component classes in
| your application. This value affects component auto-discovery and
| any Livewire file helper commands, like `artisan make:livewire`.
|
| After changing this item, run: `php artisan livewire:discover`.
|
*/
'class_namespace' => 'App\\Http\\Livewire',
/*
|--------------------------------------------------------------------------
| View Path
|--------------------------------------------------------------------------
|
| This value sets the path for Livewire component views. This affects
| file manipulation helper commands like `artisan make:livewire`.
|
*/
'view_path' => resource_path('views/livewire'),
/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
| The default layout view that will be used when rendering a component via
| Route::get('/some-endpoint', SomeComponent::class);. In this case the
| the view returned by SomeComponent will be wrapped in "layouts.app"
|
*/
'layout' => 'layouts.app',
/*
|--------------------------------------------------------------------------
| Livewire Assets URL
|--------------------------------------------------------------------------
|
| This value sets the path to Livewire JavaScript assets, for cases where
| your app's domain root is not the correct path. By default, Livewire
| will load its JavaScript assets from the app's "relative root".
|
| Examples: "/assets", "myurl.com/app".
|
*/
'asset_url' => env('LIVEWIRE_ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Livewire App URL
|--------------------------------------------------------------------------
|
| This value should be used if livewire assets are served from CDN.
| Livewire will communicate with an app through this url.
|
| Examples: "https://my-app.com", "myurl.com/app".
|
*/
'app_url' => null,
/*
|--------------------------------------------------------------------------
| Livewire Endpoint Middleware Group
|--------------------------------------------------------------------------
|
| This value sets the middleware group that will be applied to the main
| Livewire "message" endpoint (the endpoint that gets hit everytime
| a Livewire component updates). It is set to "web" by default.
|
*/
'middleware_group' => 'web',
/*
|--------------------------------------------------------------------------
| Livewire Temporary File Uploads Endpoint Configuration
|--------------------------------------------------------------------------
|
| Livewire handles file uploads by storing uploads in a temporary directory
| before the file is validated and stored permanently. All file uploads
| are directed to a global endpoint for temporary storage. The config
| items below are used for customizing the way the endpoint works.
|
*/
'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' Default: 'default'
'rules' => null, // Example: ['file', 'mimes:png,jpg'] Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' Default 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs.
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload gets invalidated.
],
/*
|--------------------------------------------------------------------------
| Manifest File Path
|--------------------------------------------------------------------------
|
| This value sets the path to the Livewire manifest file.
| The default should work for most cases (which is
| "<app_root>/bootstrap/cache/livewire-components.php"), but for specific
| cases like when hosting on Laravel Vapor, it could be set to a different value.
|
| Example: for Laravel Vapor, it would be "/tmp/storage/bootstrap/cache/livewire-components.php".
|
*/
'manifest_path' => null,
/*
|--------------------------------------------------------------------------
| Back Button Cache
|--------------------------------------------------------------------------
|
| This value determines whether the back button cache will be used on pages
| that contain Livewire. By disabling back button cache, it ensures that
| the back button shows the correct state of components, instead of
| potentially stale, cached data.
|
| Setting it to "false" (default) will disable back button cache.
|
*/
'back_button_cache' => false,
/*
|--------------------------------------------------------------------------
| Render On Redirect
|--------------------------------------------------------------------------
|
| This value determines whether Livewire will render before it's redirected
| or not. Setting it to "false" (default) will mean the render method is
| skipped when redirecting. And "true" will mean the render method is
| run before redirecting. Browsers bfcache can store a potentially
| stale view if render is skipped on redirect.
|
*/
'render_on_redirect' => false,
];

View File

@ -25,7 +25,7 @@ return [
|
*/
'filename' => null,
'filename' => 'laravel.log',
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,40 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Class Namespace
|--------------------------------------------------------------------------
|
*/
'namespace' => 'Livewire',
/*
|--------------------------------------------------------------------------
| View Path
|--------------------------------------------------------------------------
|
*/
'view' => 'Resources/views/livewire',
/*
|--------------------------------------------------------------------------
| Custom modules setup
|--------------------------------------------------------------------------
|
*/
// 'custom_modules' => [
// 'Chat' => [
// 'path' => base_path('libraries/Chat'),
// 'module_namespace' => 'Libraries\\Chat',
// // 'namespace' => 'Livewire',
// // 'view' => 'Resources/views/livewire',
// // 'name_lower' => 'chat',
// ],
// ],
];

277
config/modules.php Normal file
View File

@ -0,0 +1,277 @@
<?php
use Nwidart\Modules\Activators\FileActivator;
use Nwidart\Modules\Commands;
return [
/*
|--------------------------------------------------------------------------
| Module Namespace
|--------------------------------------------------------------------------
|
| Default module namespace.
|
*/
'namespace' => 'Modules',
/*
|--------------------------------------------------------------------------
| Module Stubs
|--------------------------------------------------------------------------
|
| Default module stubs.
|
*/
'stubs' => [
'enabled' => false,
'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'),
'files' => [
'routes/web' => 'Routes/web.php',
'routes/api' => 'Routes/api.php',
'views/index' => 'Resources/views/index.blade.php',
'views/master' => 'Resources/views/layouts/master.blade.php',
'scaffold/config' => 'Config/config.php',
'composer' => 'composer.json',
'assets/js/app' => 'Resources/assets/js/app.js',
'assets/sass/app' => 'Resources/assets/sass/app.scss',
'vite' => 'vite.config.js',
'package' => 'package.json',
],
'replacements' => [
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME'],
'routes/api' => ['LOWER_NAME'],
'vite' => ['LOWER_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
'views/index' => ['LOWER_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
'scaffold/config' => ['STUDLY_NAME'],
'composer' => [
'LOWER_NAME',
'STUDLY_NAME',
'VENDOR',
'AUTHOR_NAME',
'AUTHOR_EMAIL',
'MODULE_NAMESPACE',
'PROVIDER_NAMESPACE',
],
],
'gitkeep' => true,
],
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path used for save the generated module. This path also will be added
| automatically to list of scanned folders.
|
*/
'modules' => base_path('Modules'),
/*
|--------------------------------------------------------------------------
| Modules assets path
|--------------------------------------------------------------------------
|
| Here you may update the modules assets path.
|
*/
'assets' => public_path('modules'),
/*
|--------------------------------------------------------------------------
| The migrations path
|--------------------------------------------------------------------------
|
| Where you run 'module:publish-migration' command, where do you publish the
| the migration files?
|
*/
'migration' => base_path('database/migrations'),
/*
|--------------------------------------------------------------------------
| Generator path
|--------------------------------------------------------------------------
| Customise the paths where the folders will be generated.
| Set the generate key to false to not generate that folder
*/
'generator' => [
'config' => ['path' => 'Config', 'generate' => true],
'command' => ['path' => 'Console', 'generate' => true],
'migration' => ['path' => 'Database/Migrations', 'generate' => true],
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
'factory' => ['path' => 'Database/factories', 'generate' => true],
'model' => ['path' => 'Entities', 'generate' => true],
'routes' => ['path' => 'Routes', 'generate' => true],
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
'request' => ['path' => 'Http/Requests', 'generate' => true],
'provider' => ['path' => 'Providers', 'generate' => true],
'assets' => ['path' => 'Resources/assets', 'generate' => true],
'lang' => ['path' => 'Resources/lang', 'generate' => true],
'views' => ['path' => 'Resources/views', 'generate' => true],
'test' => ['path' => 'Tests/Unit', 'generate' => true],
'test-feature' => ['path' => 'Tests/Feature', 'generate' => true],
'repository' => ['path' => 'Repositories', 'generate' => false],
'event' => ['path' => 'Events', 'generate' => false],
'listener' => ['path' => 'Listeners', 'generate' => false],
'policies' => ['path' => 'Policies', 'generate' => false],
'rules' => ['path' => 'Rules', 'generate' => false],
'jobs' => ['path' => 'Jobs', 'generate' => false],
'emails' => ['path' => 'Emails', 'generate' => false],
'notifications' => ['path' => 'Notifications', 'generate' => false],
'resource' => ['path' => 'Transformers', 'generate' => false],
'component-view' => ['path' => 'Resources/views/components', 'generate' => false],
'component-class' => ['path' => 'View/Components', 'generate' => false],
],
],
/*
|--------------------------------------------------------------------------
| Package commands
|--------------------------------------------------------------------------
|
| Here you can define which commands will be visible and used in your
| application. If for example you don't use some of the commands provided
| you can simply comment them out.
|
*/
'commands' => [
Commands\CommandMakeCommand::class,
Commands\ComponentClassMakeCommand::class,
Commands\ComponentViewMakeCommand::class,
Commands\ControllerMakeCommand::class,
Commands\DisableCommand::class,
Commands\DumpCommand::class,
Commands\EnableCommand::class,
Commands\EventMakeCommand::class,
Commands\JobMakeCommand::class,
Commands\ListenerMakeCommand::class,
Commands\MailMakeCommand::class,
Commands\MiddlewareMakeCommand::class,
Commands\NotificationMakeCommand::class,
Commands\ProviderMakeCommand::class,
Commands\RouteProviderMakeCommand::class,
Commands\InstallCommand::class,
Commands\ListCommand::class,
Commands\ModuleDeleteCommand::class,
Commands\ModuleMakeCommand::class,
Commands\FactoryMakeCommand::class,
Commands\PolicyMakeCommand::class,
Commands\RequestMakeCommand::class,
Commands\RuleMakeCommand::class,
Commands\MigrateCommand::class,
Commands\MigrateFreshCommand::class,
Commands\MigrateRefreshCommand::class,
Commands\MigrateResetCommand::class,
Commands\MigrateRollbackCommand::class,
Commands\MigrateStatusCommand::class,
Commands\MigrationMakeCommand::class,
Commands\ModelMakeCommand::class,
Commands\PublishCommand::class,
Commands\PublishConfigurationCommand::class,
Commands\PublishMigrationCommand::class,
Commands\PublishTranslationCommand::class,
Commands\SeedCommand::class,
Commands\SeedMakeCommand::class,
Commands\SetupCommand::class,
Commands\UnUseCommand::class,
Commands\UpdateCommand::class,
Commands\UseCommand::class,
Commands\ResourceMakeCommand::class,
Commands\TestMakeCommand::class,
Commands\LaravelModulesV6Migrator::class,
],
/*
|--------------------------------------------------------------------------
| Scan Path
|--------------------------------------------------------------------------
|
| Here you define which folder will be scanned. By default will scan vendor
| directory. This is useful if you host the package in packagist website.
|
*/
'scan' => [
'enabled' => false,
'paths' => [
base_path('vendor/*/*'),
],
],
/*
|--------------------------------------------------------------------------
| Composer File Template
|--------------------------------------------------------------------------
|
| Here is the config for composer.json file, generated by this package
|
*/
'composer' => [
'vendor' => 'putrakuningan',
'author' => [
'name' => 'Daeng Deni Mardaeni',
'email' => 'ddeni05@gmail.com',
],
'composer-output' => false,
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| Here is the config for setting up caching feature.
|
*/
'cache' => [
'enabled' => false,
'driver' => 'file',
'key' => 'laravel-modules',
'lifetime' => 60,
],
/*
|--------------------------------------------------------------------------
| Choose what laravel-modules will register as custom namespaces.
| Setting one to false will require you to register that part
| in your own Service Provider class.
|--------------------------------------------------------------------------
*/
'register' => [
'translations' => true,
/**
* load files on boot or register method
*
* Note: boot not compatible with asgardcms
*
* @example boot|register
*/
'files' => 'register',
],
/*
|--------------------------------------------------------------------------
| Activators
|--------------------------------------------------------------------------
|
| You can define new types of activators here, file, database etc. The only
| required parameter is 'class'.
| The file activator will store the activation status in storage/installed_modules
*/
'activators' => [
'file' => [
'class' => FileActivator::class,
'statuses-file' => base_path('modules_statuses.json'),
'cache-key' => 'activator.installed',
'cache-lifetime' => 604800,
],
],
'activator' => 'file',
];

Some files were not shown because too many files have changed in this diff Show More