Skip to content

Commit

Permalink
Rilis 2312 (#917)
Browse files Browse the repository at this point in the history
Co-authored-by: Syahran Saputra <[email protected]>
Co-authored-by: yogiperdana <[email protected]>
Co-authored-by: sarwono <[email protected]>
Co-authored-by: Afila <[email protected]>
Co-authored-by: sarwono <[email protected]>
Co-authored-by: Suyadi <[email protected]>
Co-authored-by: apidong <[email protected]>
Co-authored-by: Andi Fahruddin Akas <[email protected]>
Co-authored-by: andifahruddinakas <[email protected]>
Co-authored-by: vickyrolanda <[email protected]>
Co-authored-by: ahmad afandi <[email protected]>
Co-authored-by: Agung Sugiarto <[email protected]>
Co-authored-by: agungsugiarto <[email protected]>
Co-authored-by: Toto <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: totoprayogo1916 <[email protected]>
Co-authored-by: Toto <[email protected]>
  • Loading branch information
18 people authored Dec 1, 2023
1 parent e028441 commit 6d8846d
Show file tree
Hide file tree
Showing 159 changed files with 1,599 additions and 1,202 deletions.
37 changes: 32 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ APP_LOG_LEVEL=debug
APP_URL=https://demodk.opendesa.id
APP_DEMO=false

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
Expand All @@ -15,28 +19,51 @@ DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
QUEUE_DRIVER=database
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

JWT_SECRET=vDInioV8kO3Ebi0o666hPjE9hXTTgyBsQ2C72vsC8miKZ3LYDuJjmKThz19JuoY2

# PANTAU
# HOST_PANTAU=
# TOKEN_PANTAU=

SENTRY_LARAVEL_DSN=https://[email protected]/6428110222
SENTRY_TRACES_SAMPLE_RATE=1.0
SENTRY_TRACES_SAMPLE_RATE=1.0

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
8 changes: 5 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.docker export-ignore
/.git* export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ["7.4", "8.0"]
php-versions: ["8.0", "8.1", "8.2"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
echo "match=false" >> $GITHUB_OUTPUT
fi
- name: Setup PHP 7.4
- name: Setup PHP 8.0
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0

- name: Install dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ public/error_log
composer.lock
.php-cs-fixer.cache
.phpcs-cache
/.vscode
15 changes: 3 additions & 12 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,21 @@

namespace App\Console;

use function base_path;

use Illuminate\Console\Scheduling\Schedule;

use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
// $schedule->command('inspire')->hourly();
}

/**
Expand All @@ -64,7 +55,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__ . '/Commands');
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
Expand Down
65 changes: 20 additions & 45 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,49 @@
use App\Models\Profil;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Sentry\Laravel\Integration;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];

/**
* A list of the exception types that are not reported.
*
* @var array
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array
* @var array<int, string>
*/
protected $dontFlash = [
// 'current_password',
'password',
'password_confirmation',
];

/**
* Report or log an exception.
* Register the exception handling callbacks for the application.
*
* @param \Throwable $exception
* @return void
*
* @throws \Throwable
*/
public function report(Throwable $exception)
public function register()
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope) {
$this->reportable(function (Throwable $e) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope): void {
$profil = Profil::first();
$scope->setUser(
[
Expand All @@ -78,52 +85,20 @@ public function report(Throwable $exception)
'nama_kecamatan' => $profil->nama_kecamatan
]
);

if (Auth::check()) {
$scope->setUser([
'email' => auth()->user()->email,
'name' => auth()->user()->name,
'role' => Auth::user()->getRoleNames()
]);
}

$scope->setTags([
'kecamatan' => $profil->nama_kecamatan,
'versi' => config('app.version')
]);
});
app('sentry')->captureException($exception);
}

parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}

/**
* Convert a validation exception into a JSON response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
* @return \Illuminate\Http\JsonResponse
*/
protected function invalidJson($request, ValidationException $exception)
{
return response()->json([
'message' => __('validation.header'),
'errors' => $exception->errors(),
], $exception->status);
Integration::captureUnhandledException($e);
});
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public function login(Request $request)
$credentials = $request->only(['email', 'password']);
$credentials['status'] = true;

if (! $token = Auth::guard('api')->attempt($credentials)) {
if (!$token = Auth::guard('api')->attempt($credentials)) {
return response()->json(['message' => 'Pengguna tidak dikenali'], 401);
}

$user = User::where('email', '=', $request->email)->first();

if (! $user->hasrole(['super-admin', 'admin-desa'])) {
if (!$user->hasrole(['super-admin', 'admin-desa'])) {
return response()->json(['message' => 'Grup pengguna bukan admin-desa'], 422);
}

Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/Api/SuratController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SuratController extends Controller
*/
public function index(Request $request)
{
if (! $this->settings['tte']) {
if (!$this->settings['tte']) {
return response()->json('Kecamatan belum mengaktifkan modul TTE', 400);
}

Expand All @@ -63,7 +63,7 @@ public function index(Request $request)
return response()->json($validator->errors(), 422);
}

if (! in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
if (!in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
Log::debug("Kode desa {$request->desa_id} tidak terdaftar di kecamatan");
return response()->json("Kode desa {$request->desa_id} tidak terdaftar di kecamatan", 400);
}
Expand All @@ -80,7 +80,7 @@ public function index(Request $request)
*/
public function store(Request $request)
{
if (! $this->settings['tte']) {
if (!$this->settings['tte']) {
return response()->json('Kecamatan belum mengaktifkan modul TTE', 400);
}

Expand All @@ -97,7 +97,7 @@ public function store(Request $request)
return response()->json($validator->errors(), 422);
}

if (! in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
if (!in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
Log::debug("Kode desa {$request->desa_id} tidak terdaftar di kecamatan");
return response()->json("Kode desa {$request->desa_id} tidak terdaftar di kecamatan", 400);
}
Expand Down Expand Up @@ -136,7 +136,7 @@ public function store(Request $request)
*/
public function download(Request $request)
{
if (! $this->settings['tte']) {
if (!$this->settings['tte']) {
return response()->json('Kecamatan belum mengaktifkan modul TTE', 400);
}

Expand All @@ -149,7 +149,7 @@ public function download(Request $request)
return response()->json($validator->errors(), 422);
}

if (! in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
if (!in_array($request->desa_id, Arr::flatten(DataDesa::pluck('desa_id')))) {
Log::debug("Kode desa {$request->desa_id} tidak terdaftar di kecamatan");
return response()->json("Kode desa {$request->desa_id} tidak terdaftar di kecamatan", 400);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public function __construct()
$this->akun_camat = Pengurus::status()->akunCamat()->first();
$this->akun_sekretaris = Pengurus::status()->akunSekretaris()->first();

if (! $this->akun_camat) {
if (!$this->akun_camat) {
SettingAplikasi::where('key', 'tte')->update(['value' => 0]);
SettingAplikasi::where('key', 'pemeriksaan_camat')->update(['value' => 0]);
}

if (! $this->akun_sekretaris) {
if (!$this->akun_sekretaris) {
SettingAplikasi::where('key', 'pemeriksaan_sekretaris')->update(['value' => 0]);
}

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Data/DataDesaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getDataDesaAjax(Request $request)
*/
public function create()
{
if (! $this->profil->kecamatan_id) {
if (!$this->profil->kecamatan_id) {
return redirect()->route('data.data-desa.index');
}

Expand Down Expand Up @@ -134,7 +134,7 @@ public function store(DesaRequest $request)
*/
public function edit($id)
{
if (! $this->profil->kecamatan_id) {
if (!$this->profil->kecamatan_id) {
return redirect()->route('data.data-desa.index');
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Data/JabatanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function index(Request $request)
return DataTables::of(Jabatan::all())
->addIndexColumn()
->addColumn('aksi', function ($row) {
if (! auth()->guest()) {
if (!auth()->guest()) {
$data['edit_url'] = route('data.jabatan.edit', $row->id);
if ($row->jenis == JenisJabatan::JabatanLainnya) {
$data['delete_url'] = route('data.jabatan.destroy', $row->id);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Data/PengurusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function index(Request $request)
return DataTables::of(Pengurus::where('status', $status))
->addIndexColumn()
->addColumn('aksi', function ($row) {
if (! auth()->guest()) {
if (!auth()->guest()) {
$data['edit_url'] = route('data.pengurus.edit', $row->id);
$data['delete_url'] = route('data.pengurus.destroy', $row->id);
if ($row->status == Status::Aktif) {
Expand Down
Loading

0 comments on commit 6d8846d

Please sign in to comment.