diff --git a/app/DataTables/Logs/AuditLogsDataTable.php b/app/DataTables/Logs/AuditLogsDataTable.php deleted file mode 100644 index 350ea93..0000000 --- a/app/DataTables/Logs/AuditLogsDataTable.php +++ /dev/null @@ -1,120 +0,0 @@ -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'); - } -} diff --git a/app/DataTables/Logs/SystemLogsDataTable.php b/app/DataTables/Logs/SystemLogsDataTable.php deleted file mode 100644 index c64385f..0000000 --- a/app/DataTables/Logs/SystemLogsDataTable.php +++ /dev/null @@ -1,143 +0,0 @@ -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 '
'.$value.'
'; - }) - ->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'); - } -} diff --git a/app/Http/Controllers/Logs/AuditLogsController.php b/app/Http/Controllers/Logs/AuditLogsController.php deleted file mode 100644 index 2001944..0000000 --- a/app/Http/Controllers/Logs/AuditLogsController.php +++ /dev/null @@ -1,35 +0,0 @@ -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(); - } -} diff --git a/app/Http/Controllers/Logs/SystemLogsController.php b/app/Http/Controllers/Logs/SystemLogsController.php deleted file mode 100644 index 1b31d47..0000000 --- a/app/Http/Controllers/Logs/SystemLogsController.php +++ /dev/null @@ -1,32 +0,0 @@ -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(); - } -} diff --git a/database/migrations/2023_04_11_043320_create_activity_log_table.php b/database/migrations/2023_04_11_043320_create_activity_log_table.php deleted file mode 100644 index cab9761..0000000 --- a/database/migrations/2023_04_11_043320_create_activity_log_table.php +++ /dev/null @@ -1,31 +0,0 @@ -create(config('activitylog.table_name'), function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('log_name')->nullable(); - $table->text('description'); - $table->nullableMorphs('subject', 'subject'); - $table->nullableMorphs('causer', 'causer'); - $table->json('properties')->nullable(); - $table->timestamps(); - $table->index('log_name'); - - $table->unsignedBigInteger('created_by')->nullable(); - $table->unsignedBigInteger('updated_by')->nullable(); - $table->unsignedBigInteger('deleted_by')->nullable(); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); - } -} diff --git a/database/migrations/2023_04_11_043321_add_event_column_to_activity_log_table.php b/database/migrations/2023_04_11_043321_add_event_column_to_activity_log_table.php deleted file mode 100644 index 7b797fd..0000000 --- a/database/migrations/2023_04_11_043321_add_event_column_to_activity_log_table.php +++ /dev/null @@ -1,22 +0,0 @@ -table(config('activitylog.table_name'), function (Blueprint $table) { - $table->string('event')->nullable()->after('subject_type'); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('event'); - }); - } -} diff --git a/database/migrations/2023_04_11_043322_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2023_04_11_043322_add_batch_uuid_column_to_activity_log_table.php deleted file mode 100644 index 8f7db66..0000000 --- a/database/migrations/2023_04_11_043322_add_batch_uuid_column_to_activity_log_table.php +++ /dev/null @@ -1,22 +0,0 @@ -table(config('activitylog.table_name'), function (Blueprint $table) { - $table->uuid('batch_uuid')->nullable()->after('properties'); - }); - } - - public function down() - { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { - $table->dropColumn('batch_uuid'); - }); - } -} diff --git a/resources/views/pages/log/audit/_action-menu.blade.php b/resources/views/pages/log/audit/_action-menu.blade.php deleted file mode 100644 index 490c347..0000000 --- a/resources/views/pages/log/audit/_action-menu.blade.php +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/resources/views/pages/log/audit/_details.blade.php b/resources/views/pages/log/audit/_details.blade.php deleted file mode 100644 index 9d697a3..0000000 --- a/resources/views/pages/log/audit/_details.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/resources/views/pages/log/audit/_table.blade.php b/resources/views/pages/log/audit/_table.blade.php deleted file mode 100644 index 28ae626..0000000 --- a/resources/views/pages/log/audit/_table.blade.php +++ /dev/null @@ -1,8 +0,0 @@ - -{{ $dataTable->table() }} - - -{{-- Inject Scripts --}} -@section('scripts') - {{ $dataTable->scripts() }} -@endsection diff --git a/resources/views/pages/log/audit/index.blade.php b/resources/views/pages/log/audit/index.blade.php deleted file mode 100644 index 97494c7..0000000 --- a/resources/views/pages/log/audit/index.blade.php +++ /dev/null @@ -1,13 +0,0 @@ - - - -
- -
- @include('pages.log.audit._table') -
- -
- - -
diff --git a/resources/views/pages/log/system/_action-menu.blade.php b/resources/views/pages/log/system/_action-menu.blade.php deleted file mode 100644 index ea6298c..0000000 --- a/resources/views/pages/log/system/_action-menu.blade.php +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/resources/views/pages/log/system/_details.blade.php b/resources/views/pages/log/system/_details.blade.php deleted file mode 100644 index 9d697a3..0000000 --- a/resources/views/pages/log/system/_details.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/resources/views/pages/log/system/_table.blade.php b/resources/views/pages/log/system/_table.blade.php deleted file mode 100644 index 28ae626..0000000 --- a/resources/views/pages/log/system/_table.blade.php +++ /dev/null @@ -1,8 +0,0 @@ - -{{ $dataTable->table() }} - - -{{-- Inject Scripts --}} -@section('scripts') - {{ $dataTable->scripts() }} -@endsection diff --git a/resources/views/pages/log/system/index.blade.php b/resources/views/pages/log/system/index.blade.php deleted file mode 100644 index da2acc5..0000000 --- a/resources/views/pages/log/system/index.blade.php +++ /dev/null @@ -1,13 +0,0 @@ - - - -
- -
- @include('pages.log.system._table') -
- -
- - -
diff --git a/routes/web.php b/routes/web.php index f14a54f..02b8f32 100644 --- a/routes/web.php +++ b/routes/web.php @@ -42,12 +42,6 @@ Route::group(['middleware' => ['auth', 'verified']], function () { Route::resource('permissions', PermissionsController::class); Route::resource('users', UsersController::class); }); - - // Logs pages - Route::prefix('log')->name('log.')->group(function () { - Route::resource('system', SystemLogsController::class)->only(['index', 'destroy']); - Route::resource('audit', AuditLogsController::class)->only(['index', 'destroy']); - }); });