diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml
deleted file mode 100644
index 508691381..000000000
--- a/.github/workflows/phpcs.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-name: Fix styling
-
-on:
- pull_request:
- branches:
- - 'dev'
- - 'master'
- - 'bug-fix'
- paths:
- - '**.php'
- - '!resources/views/**'
- - '.github/workflows/phpcs.yml'
-
-jobs:
- php-cs-fixer:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- ref: ${{github.event.pull_request.head.ref}}
- repository: ${{github.event.pull_request.head.repo.full_name}}
-
- - name: Check if PR repo matches base repo
- id: check_repo
- run: |
- if [[ "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
- echo "match=true" >> $GITHUB_OUTPUT
- else
- echo "match=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Setup PHP 8.0
- uses: shivammathur/setup-php@v2
- with:
- php-version: 8.0
-
- - name: Install dependencies
- run: |
- if [ -f composer.lock ]; then
- composer install --no-progress
- else
- composer update --no-progress
- fi
-
- - name: Run PHP CS Fixer
- run: |
- if [[ "${{ steps.check_repo.outputs.match }}" == "true" ]]; then
- ./vendor/bin/php-cs-fixer fix --allow-risky=yes
- else
- ./vendor/bin/php-cs-fixer fix --allow-risky=yes --verbose --ansi --dry-run --using-cache=no --diff
- fi
-
- - name: Commit changes
- uses: stefanzweifel/git-auto-commit-action@v4
- with:
- commit_message: "Fix styling by PHP-CS-FIXER"
diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml
new file mode 100644
index 000000000..ce5a6dedd
--- /dev/null
+++ b/.github/workflows/pint.yml
@@ -0,0 +1,16 @@
+name: Pint
+on:
+ push:
+ branches:
+ - master
+jobs:
+ phplint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 2
+ - name: "laravel-pint"
+ uses: aglipanci/laravel-pint-action@0.1.0
+ with:
+ preset: laravel
\ No newline at end of file
diff --git a/app/Console/Commands/InstallDev.php b/app/Console/Commands/InstallDev.php
index 2eb591bd3..50eb03647 100644
--- a/app/Console/Commands/InstallDev.php
+++ b/app/Console/Commands/InstallDev.php
@@ -71,7 +71,7 @@ public function handle()
$this->line('Kunci akses penginstal web');
- if (!sudahInstal()) {
+ if (! sudahInstal()) {
file_put_contents(
storage_path('installed'),
sprintf('%s berhasil DIPASANG pada %s', config('app.name'), now())
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 1a6f96094..1ce566bdf 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -32,7 +32,6 @@
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
-
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
@@ -40,7 +39,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
diff --git a/app/Enums/JenisJabatan.php b/app/Enums/JenisJabatan.php
index b9402ee3c..d0b5cdb63 100644
--- a/app/Enums/JenisJabatan.php
+++ b/app/Enums/JenisJabatan.php
@@ -38,7 +38,9 @@
*/
final class JenisJabatan extends Enum
{
- public const Camat = 1;
- public const Sekretaris = 2;
+ public const Camat = 1;
+
+ public const Sekretaris = 2;
+
public const JabatanLainnya = 3;
}
diff --git a/app/Enums/LogVerifikasiSurat.php b/app/Enums/LogVerifikasiSurat.php
index 15c9e8786..a028652c6 100644
--- a/app/Enums/LogVerifikasiSurat.php
+++ b/app/Enums/LogVerifikasiSurat.php
@@ -38,10 +38,15 @@
*/
final class LogVerifikasiSurat extends Enum
{
- public const Operator = 1;
+ public const Operator = 1;
+
public const Sekretaris = 2;
- public const Camat = 3;
- public const ProsesTTE = 4;
- public const SudahTTE = 5;
- public const Ditolak = 6;
+
+ public const Camat = 3;
+
+ public const ProsesTTE = 4;
+
+ public const SudahTTE = 5;
+
+ public const Ditolak = 6;
}
diff --git a/app/Enums/Status.php b/app/Enums/Status.php
index 83ba6bf9a..7aa56eec3 100644
--- a/app/Enums/Status.php
+++ b/app/Enums/Status.php
@@ -39,5 +39,6 @@
final class Status extends Enum
{
public const TidakAktif = 0;
- public const Aktif = 1;
+
+ public const Aktif = 1;
}
diff --git a/app/Enums/StatusSurat.php b/app/Enums/StatusSurat.php
index 8c5433633..93a119712 100644
--- a/app/Enums/StatusSurat.php
+++ b/app/Enums/StatusSurat.php
@@ -39,6 +39,8 @@
final class StatusSurat extends Enum
{
public const Permohonan = 1;
- public const Arsip = 2;
- public const Ditolak = 3;
+
+ public const Arsip = 2;
+
+ public const Ditolak = 3;
}
diff --git a/app/Enums/StatusVerifikasiSurat.php b/app/Enums/StatusVerifikasiSurat.php
index df085ae66..36d9e476a 100644
--- a/app/Enums/StatusVerifikasiSurat.php
+++ b/app/Enums/StatusVerifikasiSurat.php
@@ -38,7 +38,9 @@
*/
final class StatusVerifikasiSurat extends Enum
{
- public const TidakAktif = 1;
+ public const TidakAktif = 1;
+
public const MenungguVerifikasi = 2;
- public const TelahDiverifikasi = 3;
+
+ public const TelahDiverifikasi = 3;
}
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index ede4dc4b6..ebae2a7d2 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -75,30 +75,30 @@ class Handler extends ExceptionHandler
*/
public function register()
{
- $this->reportable(function (Throwable $e) {
- \Sentry\configureScope(function (\Sentry\State\Scope $scope): void {
- $profil = Profil::first();
- $scope->setUser(
- [
- 'nama_provinsi' => $profil->nama_provinsi,
- 'nama_kabupaten' => $profil->nama_kabupaten,
- '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')
- ]);
- });
+ // $this->reportable(function (Throwable $e) {
+ // \Sentry\configureScope(function (\Sentry\State\Scope $scope): void {
+ // $profil = Profil::first();
+ // $scope->setUser(
+ // [
+ // 'nama_provinsi' => $profil->nama_provinsi,
+ // 'nama_kabupaten' => $profil->nama_kabupaten,
+ // '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'),
+ // ]);
+ // });
- Integration::captureUnhandledException($e);
- });
+ // Integration::captureUnhandledException($e);
+ // });
}
}
diff --git a/app/Helpers/Counter.php b/app/Helpers/Counter.php
index 7a1a0373e..cdcbb4ebb 100644
--- a/app/Helpers/Counter.php
+++ b/app/Helpers/Counter.php
@@ -34,15 +34,12 @@
use App\Models\CounterPage;
use App\Models\CounterVisitor;
use Carbon\Carbon;
-
use function config;
use function env;
use function hash;
-
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\DB;
use Jaybizzle\CrawlerDetect\CrawlerDetect;
-
use function number_format;
class Counter
@@ -50,7 +47,7 @@ class Counter
public function __construct(CrawlerDetect $visitor)
{
$this->visitor = $visitor;
- $this->hasDnt = isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1 ? true : false;
+ $this->hasDnt = isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1 ? true : false;
}
/**
@@ -60,6 +57,7 @@ public function __construct(CrawlerDetect $visitor)
* @var bool
*/
private static $ignore_bots = true;
+
/**
* Check to determine if we will count hits
* from visitors that send a DO NOT TRACK header.
@@ -67,25 +65,28 @@ public function __construct(CrawlerDetect $visitor)
* @var bool
*/
private static $honor_do_not_track = false;
+
/**
* Singleton for the $page in question
*
* @var null|object
*/
private static $current_page;
+
/**
* Show view count for the requested page.
*
* Use this when you just want to show the current view count
* for the page in question. Does not add counts.
*
- * @param string $identifier A unique string to the page you are tracking
- * @param null|integer $id A unique identifier for dynamic page tracking
+ * @param string $identifier A unique string to the page you are tracking
+ * @param null|int $id A unique identifier for dynamic page tracking
* @return string Unique view count for requested resource
*/
public function show($identifier, $id = null)
{
$page = self::pageId($identifier, $id);
+
return self::countHits($page);
}
@@ -97,14 +98,15 @@ public function show($identifier, $id = null)
* Use this for pages that you want to show the count, while
* also incrementing the count.
*
- * @param string $identifier
- * @param null|integer $id
+ * @param string $identifier
+ * @param null|int $id
* @return string Unique view count for requested resource
*/
public function showAndCount($identifier, $id = null)
{
$page = self::pageId($identifier, $id);
self::processHit($page);
+
return self::countHits($page);
}
@@ -116,8 +118,8 @@ public function showAndCount($identifier, $id = null)
* if conditions are met. Ex: Count profile views, but only
* show the view count to the profile user with show()
*
- * @param string $identifier
- * @param null|integer $id
+ * @param string $identifier
+ * @param null|int $id
* @return null
*/
public function count($identifier, $id = null)
@@ -134,16 +136,16 @@ public function count($identifier, $id = null)
* Example: Show total views for the last 30 days
* Counter::allHits(30)
*
- * @param null|integer $days
+ * @param null|int $days
* @return string Unique view count for all pages
*/
public function allHits($days = null)
{
- $prefix = config('database.connections.' . config('database.default') . '.prefix');
+ $prefix = config('database.connections.'.config('database.default').'.prefix');
if ($days) {
- $hits = DB::table($prefix . 'das_counter_page_visitor')->where('created_at', '>=', Carbon::now()->subDays($days))->count();
+ $hits = DB::table($prefix.'das_counter_page_visitor')->where('created_at', '>=', Carbon::now()->subDays($days))->count();
} else {
- $hits = DB::table($prefix . 'das_counter_page_visitor')->count();
+ $hits = DB::table($prefix.'das_counter_page_visitor')->count();
}
return number_format($hits);
@@ -157,16 +159,16 @@ public function allHits($days = null)
* Example: Show total visitors for the last 30 days
* Counter::allVisitors(30)
*
- * @param null|integer $days
+ * @param null|int $days
* @return string Unique visitor count for all pages
*/
public function allVisitors($days = null)
{
- $prefix = config('database.connections.' . config('database.default') . '.prefix');
+ $prefix = config('database.connections.'.config('database.default').'.prefix');
if ($days) {
- $hits = DB::table($prefix . 'das_counter_page_visitor')->distinct('visitor_id')->where('created_at', '>=', Carbon::now()->subDays($days))->count();
+ $hits = DB::table($prefix.'das_counter_page_visitor')->distinct('visitor_id')->where('created_at', '>=', Carbon::now()->subDays($days))->count();
} else {
- $hits = DB::table($prefix . 'das_counter_page_visitor')->distinct('visitor_id')->count();
+ $hits = DB::table($prefix.'das_counter_page_visitor')->distinct('visitor_id')->count();
}
return number_format($hits);
@@ -176,7 +178,7 @@ public function allVisitors($days = null)
/**
* Processes the hit request for the page in question.
*
- * @param string $page
+ * @param string $page
* @return null
*/
private function processHit($page)
@@ -202,16 +204,17 @@ private function processHit($page)
*/
private static function hashVisitor()
{
- $cookie = Cookie::get(env('COUNTER_COOKIE', 'kd_session'));
+ $cookie = Cookie::get(env('COUNTER_COOKIE', 'kd_session'));
$visitor = $cookie !== false ? $cookie : $_SERVER['REMOTE_ADDR'];
- return hash("SHA256", env('APP_KEY') . $visitor);
+
+ return hash('SHA256', env('APP_KEY').$visitor);
}
/**
* Generates a hash based on page identifier
*
- * @param string $identifier
- * @param null|integer $id
+ * @param string $identifier
+ * @param null|int $id
* @return string
*/
private static function pageId($identifier, $id = null)
@@ -225,7 +228,7 @@ private static function pageId($identifier, $id = null)
$uuid5 = $identifier;
if ($id) {
- $uuid5 = $identifier . '|' . $id;
+ $uuid5 = $identifier.'|'.$id;
}
return $uuid5;
@@ -234,7 +237,7 @@ private static function pageId($identifier, $id = null)
/**
* Create and/or grab the visitor record
*
- * @param string $visitor hash provided by hashVisitor()
+ * @param string $visitor hash provided by hashVisitor()
* @return object Visitor eloquent object.
*/
private static function createVisitorRecordIfNotPresent($visitor)
@@ -245,7 +248,7 @@ private static function createVisitorRecordIfNotPresent($visitor)
/**
* Create and/or grab the page record
*
- * @param string $page hash provided by pageId()
+ * @param string $page hash provided by pageId()
* @return object Page eloquent object.
*/
private static function createPageIfNotPresent($page)
@@ -256,13 +259,13 @@ private static function createPageIfNotPresent($page)
/**
* Create the count record if it does not exist.
*
- * @param string $page hash provided by pageId()
+ * @param string $page hash provided by pageId()
* @return null
*/
private static function createCountIfNotPresent($page)
{
- $page_record = self::createPageIfNotPresent($page);
- $visitor = self::hashVisitor();
+ $page_record = self::createPageIfNotPresent($page);
+ $visitor = self::hashVisitor();
$visitor_record = self::createVisitorRecordIfNotPresent($visitor);
$page_record->visitors()->sync([$visitor_record->id => ['created_at' => Carbon::now()]], false);
}
@@ -270,12 +273,13 @@ private static function createCountIfNotPresent($page)
/**
* Returns hit count for the requested resource.
*
- * @param string $page hash provided by pageId()
+ * @param string $page hash provided by pageId()
* @return string Unique view count for requested resource
*/
private static function countHits($page)
{
$page_record = self::createPageIfNotPresent($page);
+
return number_format($page_record->visitors->count());
}
}
diff --git a/app/Http/Controllers/Api/Auth/AuthController.php b/app/Http/Controllers/Api/Auth/AuthController.php
index 17d11b3d6..f1406b3bf 100644
--- a/app/Http/Controllers/Api/Auth/AuthController.php
+++ b/app/Http/Controllers/Api/Auth/AuthController.php
@@ -58,20 +58,20 @@ public function __construct()
public function login(Request $request)
{
$this->validate($request, [
- 'email' => 'required|email',
+ 'email' => 'required|email',
'password' => 'required',
]);
$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);
}
@@ -91,7 +91,7 @@ public function me()
/**
* Log the user out (Invalidate the token).
*
- * @param Response $response
+ * @param Response $response
* @return JsonResponse
*/
public function logout()
@@ -114,15 +114,15 @@ public function refresh()
/**
* Get the token array structure.
*
- * @param string $token
+ * @param string $token
* @return JsonResponse
*/
protected function respondWithToken($token)
{
return response()->json([
'access_token' => $token,
- 'token_type' => 'Bearer',
- 'expires_in' => Auth::guard('api')->factory()->getTTL() * 60,
+ 'token_type' => 'Bearer',
+ 'expires_in' => Auth::guard('api')->factory()->getTTL() * 60,
]);
}
}
diff --git a/app/Http/Controllers/Api/LaporanApbdesController.php b/app/Http/Controllers/Api/LaporanApbdesController.php
index 3267f4aff..fa619f3c1 100644
--- a/app/Http/Controllers/Api/LaporanApbdesController.php
+++ b/app/Http/Controllers/Api/LaporanApbdesController.php
@@ -40,7 +40,7 @@ class LaporanApbdesController extends Controller
/**
* Tambah / Ubah Data Apbdes Sesuai OpenSID
*
- * @param ApbdesRequest $request
+ * @param ApbdesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(LaporanApbdesRequest $request)
diff --git a/app/Http/Controllers/Api/LaporanPendudukController.php b/app/Http/Controllers/Api/LaporanPendudukController.php
index bf6e17ea4..697e30d2a 100644
--- a/app/Http/Controllers/Api/LaporanPendudukController.php
+++ b/app/Http/Controllers/Api/LaporanPendudukController.php
@@ -40,7 +40,6 @@ class LaporanPendudukController extends Controller
/**
* Tambah / Ubah Data Laporan Penduduk Dari OpenSID
*
- * @param LaporanPendudukRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(LaporanPendudukRequest $request)
@@ -49,7 +48,7 @@ public function store(LaporanPendudukRequest $request)
return response()->json([
'status' => 'success',
- 'message' => 'Proses sync data Laporan Penduduk OpenSID sedang berjalan'
+ 'message' => 'Proses sync data Laporan Penduduk OpenSID sedang berjalan',
]);
}
}
diff --git a/app/Http/Controllers/Api/PembangunanController.php b/app/Http/Controllers/Api/PembangunanController.php
index 314e1c1c1..ca0381c98 100644
--- a/app/Http/Controllers/Api/PembangunanController.php
+++ b/app/Http/Controllers/Api/PembangunanController.php
@@ -43,11 +43,11 @@
class PembangunanController extends Controller
{
/**
- * Tambah Data Pembangunan Sesuai OpenSID
- *
- * @param PendudukRequest $request
- * @return \Illuminate\Http\JsonResponse
- */
+ * Tambah Data Pembangunan Sesuai OpenSID
+ *
+ * @param PendudukRequest $request
+ * @return \Illuminate\Http\JsonResponse
+ */
public function store(PembangunanRequest $request)
{
try {
@@ -67,23 +67,24 @@ public function store(PembangunanRequest $request)
// Proses impor data pembangunan
(new SinkronPembangunan())
- ->queue($extract . $filecsv = Str::replaceLast('zip', 'csv', $name));
+ ->queue($extract.$filecsv = Str::replaceLast('zip', 'csv', $name));
} catch (\Exception $e) {
report($e);
+
return response()->json([
- "message" => "Proses Sinkronisasi Data gagal. Error : " . $e->getMessage(),
- "status" => "danger"
+ 'message' => 'Proses Sinkronisasi Data gagal. Error : '.$e->getMessage(),
+ 'status' => 'danger',
]);
}
// Hapus folder temp ketika sudah selesai
Storage::deleteDirectory('temp');
// Hapus file excell temp ketika sudah selesai
- Storage::disk('public')->delete('pembangunan/' . $filecsv);
+ Storage::disk('public')->delete('pembangunan/'.$filecsv);
return response()->json([
- "message" => "Proses Sinkronisasi Data Pembangunan OpenSID sedang berjalan",
- "status" => "success"
+ 'message' => 'Proses Sinkronisasi Data Pembangunan OpenSID sedang berjalan',
+ 'status' => 'success',
]);
}
@@ -106,20 +107,21 @@ public function storeDokumentasi(PembangunanDokumentasiRequest $request)
// Proses impor data dokumentasi pembangunan
(new SinkronPembangunanDokumentasi())
- ->queue($extract . $filecsv = Str::replaceLast('zip', 'csv', $name));
+ ->queue($extract.$filecsv = Str::replaceLast('zip', 'csv', $name));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
// Hapus folder temp ketika sudah selesai
Storage::deleteDirectory('temp');
// Hapus file excell temp ketika sudah selesai
- Storage::disk('public')->delete('pembangunan/' . $filecsv);
+ Storage::disk('public')->delete('pembangunan/'.$filecsv);
return response()->json([
- "message" => "Proses Sinkronisasi Data Pembangunan OpenSID sedang berjalan",
- "status" => "success"
+ 'message' => 'Proses Sinkronisasi Data Pembangunan OpenSID sedang berjalan',
+ 'status' => 'success',
]);
}
}
diff --git a/app/Http/Controllers/Api/PendudukController.php b/app/Http/Controllers/Api/PendudukController.php
index a80295a42..d7aeaa62f 100644
--- a/app/Http/Controllers/Api/PendudukController.php
+++ b/app/Http/Controllers/Api/PendudukController.php
@@ -45,7 +45,6 @@ class PendudukController extends Controller
/**
* Hapus Data Penduduk Sesuai OpenSID
*
- * @param PendudukRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(PendudukRequest $request)
@@ -87,19 +86,20 @@ public function storedata(Request $request)
// Proses impor excell
(new SinkronPenduduk())
- ->queue($extract . $excellName = Str::replaceLast('zip', 'xlsx', $name));
+ ->queue($extract.$excellName = Str::replaceLast('zip', 'xlsx', $name));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
// Hapus folder temp ketika sudah selesai
Storage::deleteDirectory('temp');
// Hapus file excell temp ketika sudah selesai
- Storage::disk('public')->delete('penduduk/foto/' . $excellName);
+ Storage::disk('public')->delete('penduduk/foto/'.$excellName);
return response()->json([
- "message" => "Data Foto Telah Berhasil di Sinkronkan",
+ 'message' => 'Data Foto Telah Berhasil di Sinkronkan',
]);
}
}
diff --git a/app/Http/Controllers/Api/PesanController.php b/app/Http/Controllers/Api/PesanController.php
index 868edc582..b68ae5d12 100644
--- a/app/Http/Controllers/Api/PesanController.php
+++ b/app/Http/Controllers/Api/PesanController.php
@@ -48,7 +48,7 @@ public function store(PesanRequest $request)
{
$desa = DataDesa::where('desa_id', '=', $request->kode_desa)->first();
if ($desa == null) {
- return response()->json(['status' => false, 'message' => 'Desa tidak terdaftar' ]);
+ return response()->json(['status' => false, 'message' => 'Desa tidak terdaftar']);
}
if ($request->has('pesan_id')) {
@@ -58,13 +58,13 @@ public function store(PesanRequest $request)
'pesan_id' => (int) $request->pesan_id,
'text' => $request->pesan,
'pengirim' => $request->pengirim,
- 'nama_pengirim' => $request->nama_pengirim
+ 'nama_pengirim' => $request->nama_pengirim,
]);
Pesan::where('id', (int) $request->pesan_id)->update(['sudah_dibaca' => 0]);
- return response()->json(['status' => true, 'message' => 'Berhasil mengirim pesan' ]);
+ return response()->json(['status' => true, 'message' => 'Berhasil mengirim pesan']);
} catch (Exception $e) {
- return response()->json(['status' => false, 'message' => 'error Exception' ]);
+ return response()->json(['status' => false, 'message' => 'error Exception']);
}
} else {
try {
@@ -79,13 +79,13 @@ public function store(PesanRequest $request)
'pesan_id' => $id,
'text' => Purify::clean($request->get('pesan')),
'pengirim' => $request->pengirim,
- 'nama_pengirim' => $request->nama_pengirim
+ 'nama_pengirim' => $request->nama_pengirim,
]);
});
- return response()->json(['status' => true, 'message' => 'Berhasil mengirim pesan' ]);
+ return response()->json(['status' => true, 'message' => 'Berhasil mengirim pesan']);
} catch (Exception $e) {
- return response()->json(['status' => false, 'message' => 'error Exception' ]);
+ return response()->json(['status' => false, 'message' => 'error Exception']);
}
}
@@ -98,7 +98,7 @@ public function getpesan(GetPesanRequest $request)
$desa = DataDesa::where('desa_id', '=', $request->kode_desa)->first();
if ($desa == null) {
- return response()->json(['status' => false, 'message' => 'Desa tidak terdaftar' ]);
+ return response()->json(['status' => false, 'message' => 'Desa tidak terdaftar']);
}
$pesan = Pesan::whereHas('detailPesan', function ($q) use ($request) {
@@ -124,19 +124,21 @@ public function detail(Request $request)
return response()->json(['status' => true, 'data' => $pesan]);
}
- return response()->json(['status' => true, 'message' => 'Tidak ada Pesan untuk ditampilkan' ]);
+
+ return response()->json(['status' => true, 'message' => 'Tidak ada Pesan untuk ditampilkan']);
}
public function setArsipPesan(Request $request)
{
$array = json_decode($request->get('array_id'));
$pesan = Pesan::whereIn('id', $array)->update([
- 'diarsipkan' => Pesan::MASUK_ARSIP
+ 'diarsipkan' => Pesan::MASUK_ARSIP,
]);
if ($pesan > 0) {
return back()->with('success', 'Pesan berhasil ditandai!');
}
+
return back()->withInput()->with('error', 'Pesan gagal diarsipkan!');
}
}
diff --git a/app/Http/Controllers/Api/ProfilDesaController.php b/app/Http/Controllers/Api/ProfilDesaController.php
index e4abd4d87..582bc50be 100644
--- a/app/Http/Controllers/Api/ProfilDesaController.php
+++ b/app/Http/Controllers/Api/ProfilDesaController.php
@@ -42,7 +42,7 @@ public function store(ProfilDesaRequest $request)
DataDesa::where('desa_id', $request->kode_desa)->update([
'website' => $request->website,
'sebutan_desa' => $request->sebutan_desa,
- 'path' => $request->path
+ 'path' => $request->path,
]);
return response()->json([
diff --git a/app/Http/Controllers/Api/ProgamBantuanController.php b/app/Http/Controllers/Api/ProgamBantuanController.php
index 62d7575f3..094a177f4 100644
--- a/app/Http/Controllers/Api/ProgamBantuanController.php
+++ b/app/Http/Controllers/Api/ProgamBantuanController.php
@@ -59,23 +59,24 @@ public function store(ProgramBantuanRequest $request)
$zip->close();
(new SinkronBantuan())
- ->queue($extract . $csvName = Str::replaceLast('zip', 'csv', $name));
+ ->queue($extract.$csvName = Str::replaceLast('zip', 'csv', $name));
} catch (\Exception $e) {
report($e);
+
return response()->json([
- "status" => "danger",
- "message" => $e->getMessage(),
+ 'status' => 'danger',
+ 'message' => $e->getMessage(),
]);
}
// Hapus folder temp ketika sudah selesai
Storage::deleteDirectory('temp');
// Hapus file excell temp ketika sudah selesai
- Storage::disk('public')->delete('bantuan' . $csvName);
+ Storage::disk('public')->delete('bantuan'.$csvName);
return response()->json([
- "message" => "Data Bantuan Sedang di Sinkronkan",
- "status" => "success"
+ 'message' => 'Data Bantuan Sedang di Sinkronkan',
+ 'status' => 'success',
]);
}
@@ -95,21 +96,23 @@ public function storePeserta(ProgramBantuanRequest $request)
$zip->close();
// Proses impor excell
(new SinkronPesertaBantuan())
- ->queue($extract . $csvName = Str::replaceLast('zip', 'csv', $name));
+ ->queue($extract.$csvName = Str::replaceLast('zip', 'csv', $name));
} catch (\Exception $e) {
report($e);
+
return response()->json([
- "status" => "danger",
- "message" => $e->getMessage(),
+ 'status' => 'danger',
+ 'message' => $e->getMessage(),
]);
}
// Hapus folder temp ketika sudah selesai
Storage::deleteDirectory('temp');
// Hapus file excell temp ketika sudah selesai
- Storage::disk('public')->delete('bantuan/' . $csvName);
+ Storage::disk('public')->delete('bantuan/'.$csvName);
+
return response()->json([
- "status" => "success",
- "message" => "Data Bantuan Sedang di Sinkronkan",
+ 'status' => 'success',
+ 'message' => 'Data Bantuan Sedang di Sinkronkan',
]);
}
}
diff --git a/app/Http/Controllers/Api/SuratController.php b/app/Http/Controllers/Api/SuratController.php
index 37b379463..3233a3376 100644
--- a/app/Http/Controllers/Api/SuratController.php
+++ b/app/Http/Controllers/Api/SuratController.php
@@ -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);
}
@@ -63,66 +63,70 @@ 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);
}
$surat = Surat::where('desa_id', $request->desa_id)->get(['nomor', 'file', 'nama', 'nik', 'pengurus_id', 'log_verifikasi', 'keterangan']);
+
return new SuratResource(true, 'Daftar Surat', $surat);
}
/**
* store
*
- * @param mixed $request
+ * @param mixed $request
* @return void
*/
public function store(Request $request)
{
- if (!$this->settings['tte']) {
+ if (! $this->settings['tte']) {
return response()->json('Kecamatan belum mengaktifkan modul TTE', 400);
}
$validator = Validator::make($request->all(), [
'desa_id' => 'required',
- 'nik' => 'required|integer|digits:16',
+ 'nik' => 'required|integer|digits:16',
'tanggal' => 'required|date',
- 'nomor' => 'required|string|unique:das_log_surat,nomor',
- 'nama' => 'required|string',
- 'file' => 'required|file|mimes:pdf|max:2048',
+ 'nomor' => 'required|string|unique:das_log_surat,nomor',
+ 'nama' => 'required|string',
+ 'file' => 'required|file|mimes:pdf|max:2048',
]);
if ($validator->fails()) {
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);
}
- if (!Penduduk::where('nik', $request->nik)->exists()) {
+ if (! Penduduk::where('nik', $request->nik)->exists()) {
Log::debug("Penduduk dengan NIK {$request->nik} tidak terdaftar di kecamatan");
+
return response()->json("Penduduk dengan NIK {$request->nik} tidak terdaftar di kecamatan", 400);
}
- $file = $request->file('file');
- $original_name = strtolower(trim($file->getClientOriginalName()));
- $file_name = time() . '_' . $original_name;
+ $file = $request->file('file');
+ $original_name = strtolower(trim($file->getClientOriginalName()));
+ $file_name = time().'_'.$original_name;
Storage::putFileAs('public/surat', $file, $file_name);
$this->settings['pemeriksaan_camat'] ? StatusVerifikasiSurat::MenungguVerifikasi : StatusVerifikasiSurat::TidakAktif;
$surat = Surat::create([
- 'desa_id' => $request->desa_id,
- 'nik' => $request->nik,
- 'pengurus_id' => $this->akun_camat->id,
- 'tanggal' => $request->tanggal,
- 'nomor' => $request->nomor,
- 'nama' => $request->nama,
- 'file' => $file_name,
- 'verifikasi_camat' => StatusVerifikasiSurat::MenungguVerifikasi,
+ 'desa_id' => $request->desa_id,
+ 'nik' => $request->nik,
+ 'pengurus_id' => $this->akun_camat->id,
+ 'tanggal' => $request->tanggal,
+ 'nomor' => $request->nomor,
+ 'nama' => $request->nama,
+ 'file' => $file_name,
+ 'verifikasi_camat' => StatusVerifikasiSurat::MenungguVerifikasi,
'verifikasi_sekretaris' => $this->settings['pemeriksaan_sekretaris'] ? StatusVerifikasiSurat::MenungguVerifikasi : StatusVerifikasiSurat::TidakAktif,
]);
@@ -136,21 +140,22 @@ 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);
}
$validator = Validator::make($request->all(), [
'desa_id' => 'required',
- 'nomor' => 'required',
+ 'nomor' => 'required',
]);
if ($validator->fails()) {
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);
}
@@ -160,7 +165,7 @@ public function download(Request $request)
return Response::make(file_get_contents($file), 200, [
'Content-Type' => 'application/pdf',
- 'Content-Disposition' => 'inline; filename="'.$surat->file.'"'
+ 'Content-Disposition' => 'inline; filename="'.$surat->file.'"',
]);
}
}
diff --git a/app/Http/Controllers/Auth/ChangeDefaultController.php b/app/Http/Controllers/Auth/ChangeDefaultController.php
index cb7960d47..954f88b22 100644
--- a/app/Http/Controllers/Auth/ChangeDefaultController.php
+++ b/app/Http/Controllers/Auth/ChangeDefaultController.php
@@ -59,6 +59,7 @@ public function index()
public function store(ChangeRequest $request)
{
auth()->user()->update(['password' => $request->password]);
+
return redirect()->route('dashboard');
}
}
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 8a0300d63..1e6c791ce 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -73,7 +73,6 @@ public function __construct()
/**
* Get a validator for an incoming registration request.
*
- * @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
@@ -88,7 +87,6 @@ protected function validator(array $data)
/**
* Create a new user instance after a valid registration.
*
- * @param array $data
* @return \App\User
*/
protected function create(array $data)
diff --git a/app/Http/Controllers/BackEnd/EventController.php b/app/Http/Controllers/BackEnd/EventController.php
new file mode 100644
index 000000000..2d6b5c998
--- /dev/null
+++ b/app/Http/Controllers/BackEnd/EventController.php
@@ -0,0 +1,171 @@
+editColumn('start', function ($row) {
+ return Carbon::parse($row->start)->format('d-m-Y H:i');
+ })
+ ->editColumn('end', function ($row) {
+ return Carbon::parse($row->end)->format('d-m-Y H:i');
+ })
+ ->addColumn('aksi', function ($row) {
+ if ($row->status == 'OPEN') {
+ $data['show_url'] = route('event.detail', $row->slug);
+
+ if (! auth()->guest()) {
+ $data['edit_url'] = route('informasi.event.edit', $row->id);
+ $data['delete_url'] = route('informasi.event.destroy', $row->id);
+ }
+ }
+
+ if ($row->status == 'CLOSED' && $row->attachment != null) {
+ $data['download_url'] = route('informasi.event.download', $row->id);
+ }
+
+ return view('forms.aksi', $data);
+ })
+ ->make();
+ }
+
+ public function create()
+ {
+ $page_title = 'Event';
+ $page_description = 'Tambah Event';
+
+ return view('backend.event.create', compact('page_title', 'page_description'));
+ }
+
+ public function store(EventRequest $request)
+ {
+ try {
+ $waktu = explode('-', $request->waktu);
+
+ $input = $request->input();
+ $input['start'] = date('Y-m-d H:i', strtotime($waktu[0]));
+ $input['end'] = date('Y-m-d H:i', strtotime($waktu[1]));
+ $input['status'] = 'OPEN';
+
+ Event::create($input);
+ } catch (\Exception $e) {
+ report($e);
+
+ return back()->withInput()->with('error', 'Simpan Event gagal!');
+ }
+
+ return redirect()->route('informasi.event.index')->with('success', 'Event berhasil disimpan!');
+ }
+
+ public function edit(Event $event)
+ {
+ if ($event->status == 'CLOSED') {
+ return redirect()->route('informasi.event.index')->with('error', 'Event sudah ditutup! Tidak bisa diubah!');
+ }
+
+ $page_title = 'Event';
+ $page_description = 'Ubah Event';
+
+ return view('backend.event.edit', compact('page_title', 'page_description', 'event'));
+ }
+
+ public function update(EventRequest $request, Event $event)
+ {
+ try {
+ $waktu = explode('-', $request->waktu);
+ $input = $request->all();
+
+ if ($request->hasFile('attachment')) {
+ $lampiran = $request->file('attachment');
+ $fileName = $lampiran->getClientOriginalName();
+ $path = 'event/'.$event->id.'/';
+ File::deleteDirectory(base_path('public/'.$path)); //hapus directory sebelumnya
+ $lampiran->move(base_path('public/'.$path), $fileName);
+ $input['attachment'] = $path.$fileName;
+ }
+ $input['end'] = date('Y-m-d H:i', strtotime($waktu[1]));
+ $input['start'] = date('Y-m-d H:i', strtotime($waktu[0]));
+
+ $event->update($input);
+ } catch (\Exception $e) {
+ report($e);
+
+ return back()->with('error', 'Data Event gagal disimpan!');
+ }
+
+ return redirect()->route('informasi.event.index')->with('success', 'Data Event berhasil disimpan!');
+ }
+
+ public function destroy(Event $event)
+ {
+ if ($event->status == 'CLOSED') {
+ return redirect()->route('informasi.event.index')->with('error', 'Event sudah ditutup! Tidak bisa dihapus!');
+ }
+
+ try {
+ if ($event->delete()) {
+ if ($event->attachment != null && File::exists(base_path('public/'.$event->attachment))) {
+ unlink(base_path('public/'.$event->attachment));
+ }
+ }
+ } catch (\Exception $e) {
+ report($e);
+
+ return redirect()->route('informasi.event.index')->with('error', 'Event Gagal dihapus!');
+ }
+
+ return redirect()->route('informasi.event.index')->with('success', 'Event Berhasil dihapus!');
+ }
+
+ public function download(Event $event)
+ {
+ return response()->download(base_path('public/'.$event->attachment));
+ }
+}
diff --git a/app/Http/Controllers/BackEnd/ThemesController.php b/app/Http/Controllers/BackEnd/ThemesController.php
new file mode 100644
index 000000000..034210cec
--- /dev/null
+++ b/app/Http/Controllers/BackEnd/ThemesController.php
@@ -0,0 +1,98 @@
+get();
+
+ return view('backend.themes.index', compact('page_title', 'page_description', 'themes'));
+ }
+
+ public function activate(Themes $themes)
+ {
+ Themes::where('active', 1)->update(['active' => 0]);
+ $themes->update(['active' => 1]);
+
+ return redirect()->route('setting.themes.index')->with('success', 'Tema berhasil diaktifkan');
+ }
+
+ public function reScan()
+ {
+ scan_themes();
+
+ return redirect()->route('setting.themes.index')->with('success', 'Tema berhasil pindai ulang');
+ }
+
+ public function upload()
+ {
+ try {
+ $file = request()->file('file');
+
+ if ($file->getClientOriginalExtension() !== 'zip') {
+ return response()->json([
+ 'status' => 'error',
+ 'message' => 'File harus berformat .zip',
+ ]);
+ }
+
+ $fileName = $file->getClientOriginalName();
+ $filePath = storage_path('framework/themes');
+ $file->move($filePath, $fileName);
+
+ $zip = new \ZipArchive;
+ if ($zip->open("$filePath/$fileName") === true) {
+ $extractedPath = base_path('themes/extracted');
+ $zip->extractTo($extractedPath);
+ $zip->close();
+
+ $folderTheme = explode('.', $fileName)[0];
+ $composerPath = "$extractedPath/$folderTheme/composer.json";
+
+ if (file_exists($composerPath)) {
+ $composerData = json_decode(file_get_contents($composerPath), true);
+ $newFolder = base_path('themes/'.$composerData['name']);
+
+ if (File::move("$extractedPath/$folderTheme", $newFolder)) {
+ File::deleteDirectory($extractedPath);
+ File::deleteDirectory($filePath);
+
+ scan_themes();
+
+ return response()->json([
+ 'status' => 'success',
+ 'message' => 'Tema berhasil diunggah',
+ ]);
+ } else {
+ File::deleteDirectory($extractedPath);
+ File::deleteDirectory($filePath);
+ }
+ }
+ }
+ } catch (\Exception $e) {
+ Log::error('File upload failed: '.$e->getMessage());
+ }
+
+ return response()->json([
+ 'status' => 'error',
+ 'message' => 'Tema gagal diunggah',
+ ]);
+ }
+
+ // destroy
+ public function destroy(Themes $themes)
+ {
+ $themes->delete();
+
+ return redirect()->route('setting.themes.index')->with('success', 'Theme berhasil dihapus');
+ }
+}
diff --git a/resources/lang/et/installer_messages.php b/app/Http/Controllers/BackEndController.php
similarity index 53%
rename from resources/lang/et/installer_messages.php
rename to app/Http/Controllers/BackEndController.php
index ed200bcec..bd794d75a 100644
--- a/resources/lang/et/installer_messages.php
+++ b/app/Http/Controllers/BackEndController.php
@@ -29,64 +29,12 @@
* @link https://github.com/OpenSID/opendk
*/
-return [
-
- /**
- *
- * Shared translations.
- *
- */
- 'title' => 'Laraveli installer',
- 'next' => 'Järgmine samm',
-
- /**
- *
- * Home page translations.
- *
- */
- 'welcome' => [
- 'title' => 'Tere tulemast Laraveli installerisse',
- 'message' => 'Tere tulemast installatsiooniviisardisse.',
- ],
-
- /**
- *
- * Requirements page translations.
- *
- */
- 'requirements' => [
- 'title' => 'Nõuded',
- ],
-
- /**
- *
- * Permissions page translations.
- *
- */
- 'permissions' => [
- 'title' => 'Õigused',
- ],
-
- /**
- *
- * Environment page translations.
- *
- */
- 'environment' => [
- 'title' => 'Keskkonna seaded',
- 'save' => 'Salvesta .env',
- 'success' => 'Sinu .env faili seaded on salvestatud.',
- 'errors' => 'Ei saanud .env faili salvesta, palun loo see manuaalselt.',
- ],
-
- /**
- *
- * Final page translations.
- *
- */
- 'final' => [
- 'title' => 'Lõpetatud',
- 'finished' => 'Laravel on edukalt installitud',
- 'exit' => 'Väljumiseks vajuta siia',
- ],
-];
+namespace App\Http\Controllers;
+
+class BackEndController extends Controller
+{
+ public function __construct()
+ {
+ parent::__construct();
+ }
+}
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 0a9896955..9abffa53a 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -65,39 +65,48 @@ class Controller extends BaseController
* Menampilkan Sebutan Wilayah Tingkat III (Kecamatan/Distrik)
*/
protected $akun_camat;
+
protected $akun_sekretaris;
+
protected $browser_title;
+
protected $nama_camat;
+
protected $profil;
+
protected $sebutan_kepala_wilayah;
+
protected $sebutan_tambahan;
+
protected $sebutan_wilayah;
+
protected $settings;
+
protected $umum;
public function __construct()
{
if (sudahInstal()) {
- $this->profil = Profil::first();
- $this->umum = DataUmum::first();
+ $this->profil = Profil::first();
+ $this->umum = DataUmum::first();
$this->nama_camat = Pengurus::status()->camat()->first();
// Pemeriksaan akun pengurus untuk alur pemeriksaan surat
- $this->akun_camat = Pengurus::status()->akunCamat()->first();
+ $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]);
}
// Tambahan global variabel di luar setting aplikasi
$this->sebutan_tambahan = [
- 'sebutan_camat' => Jabatan::where('jenis', JenisJabatan::Camat)->first()->nama,
+ 'sebutan_camat' => Jabatan::where('jenis', JenisJabatan::Camat)->first()->nama,
'sebutan_sekretaris' => Jabatan::where('jenis', JenisJabatan::Sekretaris)->first()->nama,
];
@@ -121,29 +130,29 @@ public function __construct()
$this->kirimTrack();
// TODO : Gunakan untuk semua pengaturan jika sudah tersedia
- $this->browser_title = SettingAplikasi::where('key', 'judul_aplikasi')->first()->value ?? ucwords($this->sebutan_wilayah . ' ' . $this->profil->nama_kecamatan);
+ $this->browser_title = SettingAplikasi::where('key', 'judul_aplikasi')->first()->value ?? ucwords($this->sebutan_wilayah.' '.$this->profil->nama_kecamatan);
- $events = Event::getOpenEvents();
- $sinergi = SinergiProgram::where('status', 1)->orderBy('urutan', 'asc')->get();
- $medsos = MediaSosial::where('status', 1)->get();
- $navdesa = DataDesa::all();
+ $events = Event::getOpenEvents();
+ $sinergi = SinergiProgram::where('status', 1)->orderBy('urutan', 'asc')->get();
+ $medsos = MediaSosial::where('status', 1)->get();
+ $navdesa = DataDesa::all();
$navpotensi = TipePotensi::orderby('nama_kategori', 'ASC')->get();
- $pengurus = Pengurus::status()->get();
- $slides = Slide::orderBy('created_at', 'DESC')->get();
+ $pengurus = Pengurus::status()->get();
+ $slides = Slide::orderBy('created_at', 'DESC')->get();
View::share([
- 'profil' => $this->profil,
- 'sebutan_wilayah' => $this->sebutan_wilayah,
+ 'profil' => $this->profil,
+ 'sebutan_wilayah' => $this->sebutan_wilayah,
'sebutan_kepala_wilayah' => $this->sebutan_kepala_wilayah,
- 'browser_title' => $this->browser_title,
- 'events' => $events,
- 'sinergi' => $sinergi,
- 'medsos' => $medsos,
- 'navdesa' => $navdesa,
- 'navpotensi' => $navpotensi,
- 'camat' => $this->nama_camat,
- 'pengurus' => $pengurus->sortBy('jabatan.jenis'),
- 'slides' => $slides,
+ 'browser_title' => $this->browser_title,
+ 'events' => $events,
+ 'sinergi' => $sinergi,
+ 'medsos' => $medsos,
+ 'navdesa' => $navdesa,
+ 'navpotensi' => $navpotensi,
+ 'camat' => $this->nama_camat,
+ 'pengurus' => $pengurus->sortBy('jabatan.jenis'),
+ 'slides' => $slides,
]);
}
}
@@ -167,12 +176,12 @@ protected function kirimTrack()
'jumlahdesa_sinkronisasi' => DataDesa::count(),
'jumlah_penduduk' => Penduduk::where('status_dasar', 1)->count(),
'jumlah_keluarga' => Keluarga::count(),
- 'peta_wilayah' => $this->umum->path ?? '[[[[]]]]',
+ 'peta_wilayah' => $this->umum->path ?? '[[[[]]]]',
'batas_wilayah' => json_encode([
'bts_wil_utara' => $this->umum->bts_wil_utara,
'bts_wil_timur' => $this->umum->bts_wil_timur,
'bts_wil_selatan' => $this->umum->bts_wil_selatan,
- 'bts_wil_barat' => $this->umum->bts_wil_barat
+ 'bts_wil_barat' => $this->umum->bts_wil_barat,
]),
'sebutan_wilayah' => $this->sebutan_wilayah,
'alamat' => $this->profil->alamat,
@@ -185,17 +194,19 @@ protected function kirimTrack()
'nama_provinsi' => $this->profil->nama_provinsi,
'nama_camat' => $this->nama_camat,
'lat' => $this->umum->lat,
- 'lng' => $this->umum->lng
+ 'lng' => $this->umum->lng,
];
try {
$response = Http::withHeaders([
- 'token' => config('app.token_pantau')
- ])->post($host_pantau . 'track/opendk?token=' . config('app.token_pantau'), $data);
+ 'token' => config('app.token_pantau'),
+ ])->post($host_pantau.'track/opendk?token='.config('app.token_pantau'), $data);
cache()->put('track', date('Y m d'), 60 * 60 * 24);
+
return;
} catch (Exception $e) {
Log::notice($e);
+
return;
}
}
diff --git a/app/Http/Controllers/Counter/CounterController.php b/app/Http/Controllers/Counter/CounterController.php
index bf84d5f13..7fbfc7a50 100644
--- a/app/Http/Controllers/Counter/CounterController.php
+++ b/app/Http/Controllers/Counter/CounterController.php
@@ -39,16 +39,16 @@ class CounterController extends Controller
{
public function index()
{
- $page_title = 'Statistik Pengunjung';
+ $page_title = 'Statistik Pengunjung';
$page_description = 'Jumlah Statistik Pengunjung Website';
- $top_pages = $this->geTopPage();
+ $top_pages = $this->geTopPage();
return view('counter.index', compact('page_title', 'page_description', 'top_pages'));
}
protected function geTopPage()
{
- $sql = DB::table('das_counter_page_visitor')
+ $sql = DB::table('das_counter_page_visitor')
->selectRaw('page_id, COUNT(*) AS total')
->groupBy('page_id')
->orderBy('total', 'desc')
@@ -58,8 +58,8 @@ protected function geTopPage()
foreach ($sql as $item) {
$page = CounterPage::findOrFail($item->page_id);
$data[] = [
- 'id' => $item->page_id,
- 'url' => route($page->page),
+ 'id' => $item->page_id,
+ 'url' => route($page->page),
'total' => $item->total,
];
}
diff --git a/app/Http/Controllers/Data/AKIAKBController.php b/app/Http/Controllers/Data/AKIAKBController.php
index 4b62f00da..1762f4f71 100644
--- a/app/Http/Controllers/Data/AKIAKBController.php
+++ b/app/Http/Controllers/Data/AKIAKBController.php
@@ -36,7 +36,6 @@
use App\Models\AkiAkb;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
-
use Yajra\DataTables\Facades\DataTables;
class AKIAKBController extends Controller
@@ -48,7 +47,7 @@ class AKIAKBController extends Controller
*/
public function index()
{
- $page_title = 'AKI & AKB';
+ $page_title = 'AKI & AKB';
$page_description = 'Daftar Kematian Ibu & Bayi';
return view('data.aki_akb.index', compact('page_title', 'page_description'));
@@ -63,7 +62,7 @@ public function getDataAKIAKB()
{
return DataTables::of(AkiAkb::with(['desa'])->get())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.aki-akb.edit', $row->id);
+ $data['edit_url'] = route('data.aki-akb.edit', $row->id);
$data['delete_url'] = route('data.aki-akb.destroy', $row->id);
return view('forms.aksi', $data);
@@ -81,10 +80,10 @@ public function getDataAKIAKB()
*/
public function import()
{
- $page_title = 'AKI & AKB';
+ $page_title = 'AKI & AKB';
$page_description = 'Import AKI & AKB';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.aki_akb.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -97,7 +96,7 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
'bulan' => 'required',
'tahun' => 'required',
]);
@@ -107,22 +106,24 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
- return back()->with('error', 'Import data gagal. '. $e->getMessage());
+
+ return back()->with('error', 'Import data gagal. '.$e->getMessage());
}
+
return redirect()->route('data.aki-akb.index')->with('success', 'Import data sukses.');
}
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $akib = AkiAkb::findOrFail($id);
- $page_title = 'AKI & AKB';
- $page_description = 'Ubah AKI & AKB : ' . $akib->id;
+ $akib = AkiAkb::findOrFail($id);
+ $page_title = 'AKI & AKB';
+ $page_description = 'Ubah AKI & AKB : '.$akib->id;
return view('data.aki_akb.edit', compact('page_title', 'page_description', 'akib'));
}
@@ -130,7 +131,7 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
@@ -144,6 +145,7 @@ public function update(Request $request, $id)
AkiAkb::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal disimpan!');
}
@@ -153,7 +155,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -162,6 +164,7 @@ public function destroy($id)
AkiAkb::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.aki-akb.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/AdminKomplainController.php b/app/Http/Controllers/Data/AdminKomplainController.php
index 9547fa44c..fa113afda 100644
--- a/app/Http/Controllers/Data/AdminKomplainController.php
+++ b/app/Http/Controllers/Data/AdminKomplainController.php
@@ -46,7 +46,7 @@ class AdminKomplainController extends Controller
{
public function index()
{
- $page_title = 'Keluhan';
+ $page_title = 'Keluhan';
$page_description = 'Daftar Keluhan';
return view('sistem_komplain.admin_komplain.index', compact('page_title', 'page_description'));
@@ -62,7 +62,7 @@ public function getDataKomplain()
return DataTables::of(Komplain::with(['kategori_komplain']))
->addColumn('aksi', function ($row) {
$data['agree_url'] = route('admin-komplain.setuju', $row->id);
- $data['show_url'] = route('admin-komplain.show', $row->id);
+ $data['show_url'] = route('admin-komplain.show', $row->id);
$data['delete_url'] = route('admin-komplain.destroy', $row->id);
return view('forms.aksi', $data);
@@ -73,20 +73,21 @@ public function getDataKomplain()
->editColumn('status', function ($row) {
$status = '';
if ($row->status == 'REVIEW') {
- $status = '' . $row->status . '';
+ $status = ''.$row->status.'';
}
if ($row->status == 'DITOLAK') {
- $status = '' . $row->status . '';
+ $status = ''.$row->status.'';
}
if ($row->status == 'BELUM') {
- $status = '' . $row->status . '';
+ $status = ''.$row->status.'';
}
if ($row->status == 'SELESAI') {
- $status = '' . $row->status . '';
+ $status = ''.$row->status.'';
}
if ($row->status == 'PROSES') {
- $status = '' . $row->status . '';
+ $status = ''.$row->status.'';
}
+
return $status;
})
->rawColumns(['aksi', 'status'])->make();
@@ -102,6 +103,7 @@ public function disetujui(Request $request, $id)
Komplain::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Status Keluhan gagal disimpan!');
}
@@ -111,8 +113,8 @@ public function disetujui(Request $request, $id)
public function show($id)
{
$komplain = Komplain::findOrFail($id);
- $page_title = 'Detail Keluhan';
- $page_description = 'Detail Keluhan : ' . $komplain->judul;
+ $page_title = 'Detail Keluhan';
+ $page_description = 'Detail Keluhan : '.$komplain->judul;
$penduduk = Penduduk::where('nik', $komplain->nik)->first();
return view('sistem_komplain.admin_komplain.show', compact('page_title', 'page_description', 'komplain', 'penduduk'));
@@ -126,9 +128,9 @@ public function show($id)
*/
public function edit($id)
{
- $komplain = Komplain::findOrFail($id);
- $page_title = 'Keluhan';
- $page_description = 'Ubah Keluhan' . $komplain->komplain_id;
+ $komplain = Komplain::findOrFail($id);
+ $page_title = 'Keluhan';
+ $page_description = 'Ubah Keluhan'.$komplain->komplain_id;
return view('sistem_komplain.admin_komplain.edit', compact('page_title', 'page_description', 'komplain'));
}
@@ -141,10 +143,10 @@ public function edit($id)
public function update(Request $request, $id)
{
request()->validate([
- 'nik' => 'required|numeric',
- 'judul' => 'required',
+ 'nik' => 'required|numeric',
+ 'judul' => 'required',
'kategori' => 'required',
- 'laporan' => 'required',
+ 'laporan' => 'required',
]);
try {
@@ -156,38 +158,39 @@ public function update(Request $request, $id)
if ($request->hasFile('lampiran1')) {
$lampiran1 = $request->file('lampiran1');
$fileName1 = $lampiran1->getClientOriginalName();
- $path = "storage/komplain/" . $komplain->komplain_id . '/';
+ $path = 'storage/komplain/'.$komplain->komplain_id.'/';
$request->file('lampiran1')->move($path, $fileName1);
- $komplain->lampiran1 = $path . $fileName1;
+ $komplain->lampiran1 = $path.$fileName1;
}
if ($request->hasFile('lampiran2')) {
$lampiran2 = $request->file('lampiran2');
$fileName2 = $lampiran2->getClientOriginalName();
- $path = "storage/komplain/" . $komplain->komplain_id . '/';
+ $path = 'storage/komplain/'.$komplain->komplain_id.'/';
$request->file('lampiran2')->move($path, $fileName2);
- $komplain->lampiran2 = $path . $fileName2;
+ $komplain->lampiran2 = $path.$fileName2;
}
if ($request->hasFile('lampiran3')) {
$lampiran3 = $request->file('lampiran3');
$fileName3 = $lampiran3->getClientOriginalName();
- $path = "storage/komplain/" . $komplain->komplain_id . '/';
+ $path = 'storage/komplain/'.$komplain->komplain_id.'/';
$request->file('lampiran3')->move($path, $fileName3);
- $komplain->lampiran3 = $path . $fileName3;
+ $komplain->lampiran3 = $path.$fileName3;
}
if ($request->hasFile('lampiran4')) {
$lampiran4 = $request->file('lampiran4');
$fileName4 = $lampiran4->getClientOriginalName();
- $path = "storage/komplain/" . $komplain->komplain_id . '/';
+ $path = 'storage/komplain/'.$komplain->komplain_id.'/';
$request->file('lampiran3')->move($path, $fileName4);
- $komplain->lampiran4 = $path . $fileName4;
+ $komplain->lampiran4 = $path.$fileName4;
}
$komplain->save();
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Keluhan gagal dikirim!');
}
@@ -203,25 +206,27 @@ public function updateKomentar(Request $request, $id)
$jawabKomplain->save();
$response = [
'status' => 'success',
- 'msg' => 'Jawaban berhasil disimpan!',
+ 'msg' => 'Jawaban berhasil disimpan!',
];
+
return response()->json($response);
} catch (Exception $e) {
$response = [
'status' => 'success',
- 'msg' => 'Jawaban Gagal disimpan!',
+ 'msg' => 'Jawaban Gagal disimpan!',
];
+
return response()->json($response);
}
}
public function statistik()
{
- $page_title = 'Statistik Keluhan';
+ $page_title = 'Statistik Keluhan';
$page_description = 'Data Statistik Keluhan Masyarakat';
- $chart_kategori = $this->getChartKategori();
- $chart_status = $this->getChartStatus();
- $chart_desa = $this->getChartDesa();
+ $chart_kategori = $this->getChartKategori();
+ $chart_status = $this->getChartStatus();
+ $chart_desa = $this->getChartDesa();
return view('sistem_komplain.admin_komplain.statistik', compact('page_title', 'page_description', 'chart_kategori', 'chart_status', 'chart_desa'));
}
@@ -229,11 +234,11 @@ public function statistik()
protected function getChartKategori()
{
$data_chart = [];
- $kategori = KategoriKomplain::all();
+ $kategori = KategoriKomplain::all();
foreach ($kategori as $value) {
- $query_total = DB::table('das_komplain')
+ $query_total = DB::table('das_komplain')
->where('kategori', '=', $value->id);
- $total = $query_total->count();
+ $total = $query_total->count();
$data_chart[] = ['kategori' => $value->nama, 'value' => $total];
}
@@ -243,12 +248,12 @@ protected function getChartKategori()
protected function getChartStatus()
{
$data_chart = [];
- $status = ['REVIEW', 'DITOLAK', 'BELUM', 'PROSES', 'SELESAI'];
- $colors = ['REVIEW' => '#f4f4f4', 'DITOLAK' => '#c9302c', 'BELUM' => '#286090', 'PROSES' => '#ec971f', 'SELESAI' => '#00a65a'];
+ $status = ['REVIEW', 'DITOLAK', 'BELUM', 'PROSES', 'SELESAI'];
+ $colors = ['REVIEW' => '#f4f4f4', 'DITOLAK' => '#c9302c', 'BELUM' => '#286090', 'PROSES' => '#ec971f', 'SELESAI' => '#00a65a'];
foreach ($status as $value) {
- $query_total = DB::table('das_komplain')
+ $query_total = DB::table('das_komplain')
->where('status', '=', $value);
- $total = $query_total->count();
+ $total = $query_total->count();
$data_chart[] = ['status' => ucfirst(strtolower($value)), 'value' => $total, 'color' => $colors[$value]];
}
@@ -258,12 +263,12 @@ protected function getChartStatus()
protected function getChartDesa()
{
$data_chart = [];
- $desa = DataDesa::all();
+ $desa = DataDesa::all();
foreach ($desa as $value) {
- $query_total = DB::table('das_komplain')
+ $query_total = DB::table('das_komplain')
->join('das_penduduk', 'das_komplain.nik', '=', 'das_penduduk.nik')
->where('das_penduduk.desa_id', $value->desa_id);
- $total = $query_total->count();
+ $total = $query_total->count();
$data_chart[] = ['desa' => $value->nama, 'value' => $total];
}
@@ -277,21 +282,23 @@ public function getKomentar($id)
'status' => 'success',
'data' => $jawab,
];
+
return response()->json($response);
}
/**
- * Display the specified resource.
- *
- * @param int $id
- * @return Response
- */
+ * Display the specified resource.
+ *
+ * @param int $id
+ * @return Response
+ */
public function destroy($id)
{
try {
Komplain::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('admin-komplain.index')->with('error', 'Keluhan gagal dihapus!');
}
@@ -304,6 +311,7 @@ public function deletekomentar($id)
JawabKomplain::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Komentar Keluhan gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/AnggaranDesaController.php b/app/Http/Controllers/Data/AnggaranDesaController.php
index d00d24f68..24cbed8ca 100644
--- a/app/Http/Controllers/Data/AnggaranDesaController.php
+++ b/app/Http/Controllers/Data/AnggaranDesaController.php
@@ -42,7 +42,7 @@ class AnggaranDesaController extends Controller
{
public function index()
{
- $page_title = 'APBDes';
+ $page_title = 'APBDes';
$page_description = 'Data APBDes';
return view('data.anggaran_desa.index', compact('page_title', 'page_description'));
@@ -50,27 +50,38 @@ public function index()
public function getDataAnggaran()
{
- return DataTables::of(AnggaranDesa::with('desa')->get())
- ->addColumn('aksi', function ($row) {
- $data['delete_url'] = route('data.anggaran-desa.destroy', $row->id);
-
- return view('forms.aksi', $data);
- })->editColumn('bulan', function ($row) {
- return months_list()[$row->bulan];
- })
- ->editColumn('jumlah', function ($row) {
- return number_format($row->jumlah, 2);
- })
- ->rawColumns(['aksi'])->make();
+ if (request()->ajax()) {
+ $desa = request()->input('desa');
+
+ return DataTables::of(
+ AnggaranDesa::when($desa && $desa !== 'Semua', function ($query) use ($desa) {
+ return $query->where('desa_id', $desa);
+ })
+ ->with('desa')
+ ->get()
+ )
+ ->addColumn('aksi', function ($row) {
+ $data['delete_url'] = route('data.anggaran-desa.destroy', $row->id);
+
+ return view('forms.aksi', $data);
+ })->editColumn('bulan', function ($row) {
+ return months_list()[$row->bulan];
+ })
+ ->editColumn('jumlah', function ($row) {
+ return number_format($row->jumlah, 2);
+ })
+ ->rawColumns(['aksi'])
+ ->make();
+ }
}
public function import()
{
- $page_title = 'APBDes';
+ $page_title = 'APBDes';
$page_description = 'Import APBDes';
- $years_list = years_list();
- $months_list = months_list();
- $list_desa = DataDesa::all();
+ $years_list = years_list();
+ $months_list = months_list();
+ $list_desa = DataDesa::all();
return view('data.anggaran_desa.import', compact('page_title', 'page_description', 'years_list', 'months_list', 'list_desa'));
}
@@ -82,6 +93,7 @@ public function do_import(AnggaranDesaRequest $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -94,6 +106,7 @@ public function destroy($id)
AnggaranDesa::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.anggaran-desa.index')->with('error', 'Data gagal dihapus.');
}
diff --git a/app/Http/Controllers/Data/AnggaranRealisasiController.php b/app/Http/Controllers/Data/AnggaranRealisasiController.php
index 670e02a6b..1624c0d6b 100644
--- a/app/Http/Controllers/Data/AnggaranRealisasiController.php
+++ b/app/Http/Controllers/Data/AnggaranRealisasiController.php
@@ -42,7 +42,7 @@ class AnggaranRealisasiController extends Controller
{
public function index()
{
- $page_title = 'Anggran & Realisasi';
+ $page_title = 'Anggran & Realisasi';
$page_description = 'Data Anggran & Realisasi';
return view('data.anggaran_realisasi.index', compact('page_title', 'page_description'));
@@ -57,7 +57,7 @@ public function getDataAnggaran()
{
return DataTables::of(AnggaranRealisasi::all())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.anggaran-realisasi.edit', $row->id);
+ $data['edit_url'] = route('data.anggaran-realisasi.edit', $row->id);
$data['delete_url'] = route('data.anggaran-realisasi.destroy', $row->id);
return view('forms.aksi', $data);
@@ -74,10 +74,10 @@ public function getDataAnggaran()
*/
public function import()
{
- $page_title = 'Anggaran & Realisasi';
- $page_description = 'Import Anggaran & Realisasi' ;
- $years_list = years_list();
- $months_list = months_list();
+ $page_title = 'Anggaran & Realisasi';
+ $page_description = 'Import Anggaran & Realisasi';
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.anggaran_realisasi.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -90,7 +90,7 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
'bulan' => 'required|unique:das_anggaran_realisasi',
'tahun' => 'required|unique:das_anggaran_realisasi',
]);
@@ -100,6 +100,7 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -109,14 +110,14 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $anggaran = AnggaranRealisasi::findOrFail($id);
- $page_title = 'Anggaran & Realisasi';
- $page_description = 'Ubah Anggaran & Realisasi : ' . $anggaran->id;
+ $anggaran = AnggaranRealisasi::findOrFail($id);
+ $page_title = 'Anggaran & Realisasi';
+ $page_description = 'Ubah Anggaran & Realisasi : '.$anggaran->id;
return view('data.anggaran_realisasi.edit', compact('page_title', 'page_description', 'anggaran'));
}
@@ -124,19 +125,19 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
request()->validate([
- 'bulan' => 'required',
- 'tahun' => 'required',
- 'total_anggaran' => 'required|numeric',
- 'total_belanja' => 'required|numeric',
- 'belanja_pegawai' => 'required|numeric',
- 'belanja_barang_jasa' => 'required|numeric',
- 'belanja_modal' => 'required|numeric',
+ 'bulan' => 'required',
+ 'tahun' => 'required',
+ 'total_anggaran' => 'required|numeric',
+ 'total_belanja' => 'required|numeric',
+ 'belanja_pegawai' => 'required|numeric',
+ 'belanja_barang_jasa' => 'required|numeric',
+ 'belanja_modal' => 'required|numeric',
'belanja_tidak_langsung' => 'required|numeric',
]);
@@ -144,6 +145,7 @@ public function update(Request $request, $id)
AnggaranRealisasi::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal diubah!');
}
@@ -153,7 +155,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -162,6 +164,7 @@ public function destroy($id)
AnggaranRealisasi::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.anggaran-realisasi.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/DataDesaController.php b/app/Http/Controllers/Data/DataDesaController.php
index 07016a6e9..5eff444a2 100644
--- a/app/Http/Controllers/Data/DataDesaController.php
+++ b/app/Http/Controllers/Data/DataDesaController.php
@@ -56,7 +56,7 @@ public function __construct()
*/
public function index()
{
- $page_title = 'Desa';
+ $page_title = 'Desa';
$page_description = 'Daftar Desa';
return view('data.data_desa.index', compact('page_title', 'page_description'));
@@ -67,7 +67,7 @@ public function getDataDesa()
return DataTables::of(DataDesa::get())
->addColumn('aksi', function ($row) {
if ($this->profil->kecamatan_id) {
- $data['edit_url'] = route('data.data-desa.edit', $row->id);
+ $data['edit_url'] = route('data.data-desa.edit', $row->id);
}
$data['peta'] = route('data.data-desa.peta', $row->id);
$data['delete_url'] = route('data.data-desa.destroy', $row->id);
@@ -75,7 +75,7 @@ public function getDataDesa()
return view('forms.aksi', $data);
})
->editColumn('website', function ($row) {
- return '' . htmlentities($row->website) . '';
+ return ''.htmlentities($row->website).'';
})
->rawColumns(['website', 'aksi'])->make();
}
@@ -94,14 +94,14 @@ 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');
}
- $page_title = 'Desa';
+ $page_title = 'Desa';
$page_description = 'Tambah Desa';
- $profil = $this->profil;
- $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
+ $profil = $this->profil;
+ $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
return view('data.data_desa.create', compact('page_title', 'page_description', 'profil', 'status_pantau'));
}
@@ -120,6 +120,7 @@ public function store(DesaRequest $request)
$desa->save();
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data Desa gagal disimpan!');
}
@@ -134,15 +135,15 @@ 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');
}
- $desa = DataDesa::findOrFail($id);
- $page_title = 'Desa';
- $page_description = 'Ubah Desa : ' . $desa->nama;
- $profil = $this->profil;
- $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
+ $desa = DataDesa::findOrFail($id);
+ $page_title = 'Desa';
+ $page_description = 'Ubah Desa : '.$desa->nama;
+ $profil = $this->profil;
+ $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
return view('data.data_desa.edit', compact('page_title', 'page_description', 'desa', 'profil', 'status_pantau'));
}
@@ -162,6 +163,7 @@ public function update(DesaRequest $request, $id)
$desa->save();
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data Desa gagal disimpan!');
}
@@ -200,6 +202,7 @@ public function destroy($id)
DataDesa::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.data-desa.index')->with('error', 'Data Desa gagal dihapus!');
}
@@ -233,12 +236,13 @@ public function getDesaKecamatan()
];
DataDesa::query()->updateOrInsert([
- 'desa_id' => $value['kode_desa']
+ 'desa_id' => $value['kode_desa'],
], $insert);
}
}
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.data-desa.index')->with('error', 'Data Desa gagal ditambahkan.');
}
@@ -247,9 +251,9 @@ public function getDesaKecamatan()
public function peta($id)
{
- $desa = DataDesa::findOrFail($id);
- $page_title = 'Desa';
- $page_description = 'Peta Desa : ' . $desa->nama;
+ $desa = DataDesa::findOrFail($id);
+ $page_title = 'Desa';
+ $page_description = 'Peta Desa : '.$desa->nama;
return view('data.data_desa.peta', compact('page_title', 'page_description', 'desa'));
}
@@ -257,11 +261,12 @@ public function peta($id)
public function getAjaxPetaDesa(Request $request)
{
if (request()->ajax()) {
- $data = DataDesa::all();
+ $data = DataDesa::all();
+
return response()->json([
'status' => 'success',
'message' => 'Proses sinkronisasi identitas desa sudah selesai',
- 'data' => $data
+ 'data' => $data,
]);
}
}
diff --git a/app/Http/Controllers/Data/DataPembangunanController.php b/app/Http/Controllers/Data/DataPembangunanController.php
index 9799f5156..2716b9001 100644
--- a/app/Http/Controllers/Data/DataPembangunanController.php
+++ b/app/Http/Controllers/Data/DataPembangunanController.php
@@ -42,9 +42,9 @@ class DataPembangunanController extends Controller
{
public function index()
{
- $page_title = 'Pembangunan';
+ $page_title = 'Pembangunan';
$page_description = 'Data Pembangunan';
- $list_desa = DataDesa::get();
+ $list_desa = DataDesa::get();
return view('data.pembangunan.index', compact('page_title', 'page_description', 'list_desa'));
}
@@ -62,7 +62,8 @@ public function getPembangunan(Request $request)
return DataTables::of($pembangunan)
->addColumn('aksi', function ($row) {
- $data['detail_url'] = route('data.pembangunan.rincian', ['id' => $row->id,'desa_id' => $row->desa_id]);
+ $data['detail_url'] = route('data.pembangunan.rincian', ['id' => $row->id, 'desa_id' => $row->desa_id]);
+
return view('forms.aksi', $data);
})->make();
}
@@ -70,9 +71,9 @@ public function getPembangunan(Request $request)
public function rincian($id, $desa_id)
{
- $page_title = 'Pembangunan';
+ $page_title = 'Pembangunan';
$page_description = 'Rincian Pembangunan';
- $pembangunan = Pembangunan::where('id', $id)->where('desa_id', $desa_id)->first();
+ $pembangunan = Pembangunan::where('id', $id)->where('desa_id', $desa_id)->first();
return view('data.pembangunan.rincian', compact('page_title', 'page_description', 'pembangunan'));
}
@@ -81,6 +82,7 @@ public function getrinciandata($id, $desa_id)
{
if (request()->ajax()) {
$pembangunanDokumentasi = PembangunanDokumentasi::where('desa_id', $desa_id)->where('id_pembangunan', $id)->get();
+
return DataTables::of($pembangunanDokumentasi)
->addIndexColumn()
->editColumn('created_at', function ($row) {
diff --git a/app/Http/Controllers/Data/DataUmumController.php b/app/Http/Controllers/Data/DataUmumController.php
index 93dd85350..be9f7d6c4 100644
--- a/app/Http/Controllers/Data/DataUmumController.php
+++ b/app/Http/Controllers/Data/DataUmumController.php
@@ -32,6 +32,7 @@
namespace App\Http\Controllers\Data;
use App\Http\Controllers\Controller;
+use App\Http\Requests\DataUmumRequest;
use App\Models\DataUmum;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -45,9 +46,9 @@ class DataUmumController extends Controller
*/
public function index()
{
- $data_umum = DataUmum::first();
- $luas_wilayah = $data_umum['luas_wilayah_value'];
- $page_title = 'Data Umum';
+ $data_umum = DataUmum::first();
+ $luas_wilayah = $data_umum['luas_wilayah_value'];
+ $page_title = 'Data Umum';
$page_description = 'Ubah Data Umum';
return view('data.data_umum.edit', compact('page_title', 'page_description', 'data_umum', 'luas_wilayah'));
@@ -59,38 +60,14 @@ public function index()
* @param int $id
* @return Response
*/
- public function update(Request $request, $id)
+ public function update(DataUmumRequest $request, $id)
{
- request()->validate([
- 'sejarah' => 'required',
- 'sumber_luas_wilayah' => 'required',
- 'luas_wilayah' => 'required',
- 'bts_wil_utara' => 'required',
- 'bts_wil_timur' => 'required',
- 'bts_wil_selatan' => 'required',
- 'bts_wil_barat' => 'required',
- 'jml_puskesmas' => 'required',
- 'jml_puskesmas_pembantu' => 'required',
- 'jml_posyandu' => 'required',
- 'jml_pondok_bersalin' => 'required',
- 'jml_paud' => 'required',
- 'jml_sd' => 'required',
- 'jml_smp' => 'required',
- 'jml_sma' => 'required',
- 'jml_masjid_besar' => 'required',
- 'jml_mushola' => 'required',
- 'jml_gereja' => 'required',
- 'jml_pasar' => 'required',
- 'jml_balai_pertemuan' => 'required',
- 'lat' => 'required',
- 'lng' => 'required',
- ]);
-
try {
$data = ($request->sumber_luas_wilayah == 1) ? $request->all() : $request->except('luas_wilayah');
DataUmum::findOrFail($id)->update($data);
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Update Data Umum gagal!');
}
@@ -111,6 +88,7 @@ public function resetPeta($id)
} catch (\Exception $e) {
report($e);
}
+
return response()->json();
}
}
diff --git a/app/Http/Controllers/Data/EpidemiPenyakitController.php b/app/Http/Controllers/Data/EpidemiPenyakitController.php
index 097e83389..dc2dfbada 100644
--- a/app/Http/Controllers/Data/EpidemiPenyakitController.php
+++ b/app/Http/Controllers/Data/EpidemiPenyakitController.php
@@ -48,10 +48,11 @@ class EpidemiPenyakitController extends Controller
*/
public function index()
{
- $page_title = 'Epidemi Penyakit';
+ $page_title = 'Epidemi Penyakit';
$page_description = 'Daftar Epidemi Penyakit';
+ $jenisPenyakit = JenisPenyakit::pluck('nama', 'id');
- return view('data.epidemi_penyakit.index', compact('page_title', 'page_description'));
+ return view('data.epidemi_penyakit.index', compact('page_title', 'page_description', 'jenisPenyakit'));
}
/**
@@ -63,7 +64,7 @@ public function getDataAKIAKB()
{
return DataTables::of(EpidemiPenyakit::with(['penyakit', 'desa'])->get())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.epidemi-penyakit.edit', $row->id);
+ $data['edit_url'] = route('data.epidemi-penyakit.edit', $row->id);
$data['delete_url'] = route('data.epidemi-penyakit.destroy', $row->id);
return view('forms.aksi', $data);
@@ -81,11 +82,11 @@ public function getDataAKIAKB()
*/
public function import()
{
- $page_title = 'Epidemi Penyakit';
+ $page_title = 'Epidemi Penyakit';
$page_description = 'Import Epidemi Penyakit';
- $years_list = years_list();
- $months_list = months_list();
- $jenis_penyakit = JenisPenyakit::pluck('nama', 'id');
+ $years_list = years_list();
+ $months_list = months_list();
+ $jenis_penyakit = JenisPenyakit::pluck('nama', 'id');
return view('data.epidemi_penyakit.import', compact('page_title', 'page_description', 'years_list', 'months_list', 'jenis_penyakit'));
}
@@ -98,7 +99,7 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
'bulan' => 'required',
'tahun' => 'required',
]);
@@ -108,7 +109,8 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
- return back()->with('error', 'Import data gagal. '. $e->getMessage());
+
+ return back()->with('error', 'Import data gagal. '.$e->getMessage());
}
return redirect()->route('data.epidemi-penyakit.index')->with('success', 'Import data sukses.');
@@ -117,15 +119,15 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $epidemi = EpidemiPenyakit::findOrFail($id);
- $page_title = 'Epidemi Penyakit';
- $page_description = 'Ubah Epidemi Penyakit : ' . $epidemi->penyakit->nama;
- $jenis_penyakit = JenisPenyakit::pluck('nama', 'id');
+ $epidemi = EpidemiPenyakit::findOrFail($id);
+ $page_title = 'Epidemi Penyakit';
+ $page_description = 'Ubah Epidemi Penyakit : '.$epidemi->penyakit->nama;
+ $jenis_penyakit = JenisPenyakit::pluck('nama', 'id');
return view('data.epidemi_penyakit.edit', compact('page_title', 'page_description', 'epidemi', 'jenis_penyakit'));
}
@@ -133,22 +135,23 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
request()->validate([
'jumlah_penderita' => 'required',
- 'penyakit_id' => 'required',
- 'bulan' => 'required',
- 'tahun' => 'required',
+ 'penyakit_id' => 'required',
+ 'bulan' => 'required',
+ 'tahun' => 'required',
]);
try {
EpidemiPenyakit::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal diubah!');
}
@@ -158,7 +161,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -167,6 +170,7 @@ public function destroy($id)
EpidemiPenyakit::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.epidemi-penyakit.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/FasilitasPaudController.php b/app/Http/Controllers/Data/FasilitasPaudController.php
index 75ceb5855..bc710ff49 100644
--- a/app/Http/Controllers/Data/FasilitasPaudController.php
+++ b/app/Http/Controllers/Data/FasilitasPaudController.php
@@ -42,8 +42,9 @@ class FasilitasPaudController extends Controller
{
public function index()
{
- $page_title = 'Fasilitas PAUD';
+ $page_title = 'Fasilitas PAUD';
$page_description = 'Data Fasilitas PAUD';
+
return view('data.fasilitas_paud.index', compact('page_title', 'page_description'));
}
@@ -56,7 +57,7 @@ public function getDataFasilitasPAUD()
{
return DataTables::of(FasilitasPAUD::with(['desa'])->get())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.fasilitas-paud.edit', $row->id);
+ $data['edit_url'] = route('data.fasilitas-paud.edit', $row->id);
$data['delete_url'] = route('data.fasilitas-paud.destroy', $row->id);
return view('forms.aksi', $data);
@@ -71,10 +72,10 @@ public function getDataFasilitasPAUD()
*/
public function import()
{
- $page_title = 'Import';
+ $page_title = 'Import';
$page_description = 'Import Data Fasilitas PAUD';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.fasilitas_paud.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -87,9 +88,9 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'desa_id' => 'required|unique:das_fasilitas_paud,desa_id',
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
- 'tahun' => 'required|unique:das_fasilitas_paud',
+ 'desa_id' => 'required|unique:das_fasilitas_paud,desa_id',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'tahun' => 'required|unique:das_fasilitas_paud',
'semester' => 'required|unique:das_fasilitas_paud',
]);
@@ -98,6 +99,7 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -107,14 +109,14 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $fasilitas = FasilitasPAUD::with(['desa'])->findOrFail($id);
- $page_title = 'Fasilitas PAUD';
- $page_description = 'Ubah Fasilitas PAUD : Desa ' . $fasilitas->desa->nama;
+ $fasilitas = FasilitasPAUD::with(['desa'])->findOrFail($id);
+ $page_title = 'Fasilitas PAUD';
+ $page_description = 'Ubah Fasilitas PAUD : Desa '.$fasilitas->desa->nama;
return view('data.fasilitas_paud.edit', compact('page_title', 'page_description', 'fasilitas'));
}
@@ -122,23 +124,24 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
request()->validate([
- 'jumlaah_paud' => 'required',
- 'jumlah_guru_paud' => 'required',
+ 'jumlaah_paud' => 'required',
+ 'jumlah_guru_paud' => 'required',
'jumlah_siswa_paud' => 'required',
- 'semester' => 'required',
- 'tahun' => 'required',
+ 'semester' => 'required',
+ 'tahun' => 'required',
]);
try {
FasilitasPAUD::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal diubah!');
}
@@ -148,7 +151,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -157,6 +160,7 @@ public function destroy($id)
FasilitasPAUD::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.fasilitas-paud.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/ImunisasiController.php b/app/Http/Controllers/Data/ImunisasiController.php
index 6cf218cb9..044b2b038 100644
--- a/app/Http/Controllers/Data/ImunisasiController.php
+++ b/app/Http/Controllers/Data/ImunisasiController.php
@@ -47,7 +47,7 @@ class ImunisasiController extends Controller
*/
public function index()
{
- $page_title = 'Imunisasi';
+ $page_title = 'Imunisasi';
$page_description = 'Daftar Imunisasi';
return view('data.imunisasi.index', compact('page_title', 'page_description'));
@@ -62,7 +62,7 @@ public function getDataAKIAKB()
{
return DataTables::of(Imunisasi::with(['desa'])->get())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.imunisasi.edit', $row->id);
+ $data['edit_url'] = route('data.imunisasi.edit', $row->id);
$data['delete_url'] = route('data.imunisasi.destroy', $row->id);
return view('forms.aksi', $data);
@@ -80,10 +80,10 @@ public function getDataAKIAKB()
*/
public function import()
{
- $page_title = 'Imunisasi';
+ $page_title = 'Imunisasi';
$page_description = 'Impor Imunisasi';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.imunisasi.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -96,7 +96,7 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
'bulan' => 'required',
'tahun' => 'required',
]);
@@ -106,7 +106,8 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
- return back()->with('error', 'Import data gagal. ' . $e->getMessage());
+
+ return back()->with('error', 'Import data gagal. '.$e->getMessage());
}
return redirect()->route('data.imunisasi.index')->with('success', 'Import data sukses.');
@@ -115,14 +116,14 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $imunisasi = Imunisasi::findOrFail($id);
- $page_title = 'Imunisasi';
- $page_description = 'Ubah Imunisasi : Cakupan Imunisasi' . $imunisasi->cakupan_imunisasi;
+ $imunisasi = Imunisasi::findOrFail($id);
+ $page_title = 'Imunisasi';
+ $page_description = 'Ubah Imunisasi : Cakupan Imunisasi'.$imunisasi->cakupan_imunisasi;
return view('data.imunisasi.edit', compact('page_title', 'page_description', 'imunisasi'));
}
@@ -130,7 +131,7 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
@@ -143,7 +144,8 @@ public function update(Request $request, $id)
Imunisasi::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
- return back()->withInput()->with('error', 'Data gagal diubah! '. $e->getMessage());
+
+ return back()->withInput()->with('error', 'Data gagal diubah! '.$e->getMessage());
}
return redirect()->route('data.imunisasi.index')->with('success', 'Data berhasil diubah!');
@@ -152,7 +154,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -161,6 +163,7 @@ public function destroy($id)
Imunisasi::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.imunisasi.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/JabatanController.php b/app/Http/Controllers/Data/JabatanController.php
index 696669796..c798b9741 100644
--- a/app/Http/Controllers/Data/JabatanController.php
+++ b/app/Http/Controllers/Data/JabatanController.php
@@ -48,15 +48,15 @@ class JabatanController extends Controller
*/
public function index(Request $request)
{
- $page_title = 'Data Jabatan';
+ $page_title = 'Data Jabatan';
$page_description = 'Daftar Data Jabatan';
if ($request->ajax()) {
return DataTables::of(Jabatan::all())
->addIndexColumn()
->addColumn('aksi', function ($row) {
- if (!auth()->guest()) {
- $data['edit_url'] = route('data.jabatan.edit', $row->id);
+ 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);
}
@@ -78,7 +78,7 @@ public function index(Request $request)
*/
public function create()
{
- $page_title = 'Jabatan';
+ $page_title = 'Jabatan';
$page_description = 'Tambah Jabatan';
return view('data.jabatan.create', compact('page_title', 'page_description'));
@@ -95,6 +95,7 @@ public function store(JabatanRequest $request)
Jabatan::create($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Jabatan gagal ditambah!');
}
@@ -104,14 +105,14 @@ public function store(JabatanRequest $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $jabatan = Jabatan::findOrFail($id);
- $page_title = 'Jabatan';
- $page_description = 'Ubah Jabatan : ' . $jabatan->nama;
+ $jabatan = Jabatan::findOrFail($id);
+ $page_title = 'Jabatan';
+ $page_description = 'Ubah Jabatan : '.$jabatan->nama;
return view('data.jabatan.edit', compact('page_title', 'page_description', 'jabatan'));
}
@@ -119,16 +120,16 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
-
public function update(JabatanRequest $request, $id)
{
try {
Jabatan::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Jabatan gagal diubah!');
}
@@ -138,7 +139,7 @@ public function update(JabatanRequest $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -147,6 +148,7 @@ public function destroy($id)
Jabatan::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.jabatan.index')->with('error', 'Jabatan gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/KeluargaController.php b/app/Http/Controllers/Data/KeluargaController.php
index 2ffc41280..f777a5844 100644
--- a/app/Http/Controllers/Data/KeluargaController.php
+++ b/app/Http/Controllers/Data/KeluargaController.php
@@ -31,11 +31,12 @@
namespace App\Http\Controllers\Data;
-use App\Http\Controllers\Controller;
+use App\Models\DataDesa;
use App\Models\Keluarga;
use App\Models\Penduduk;
use Illuminate\Http\Response;
use Yajra\DataTables\DataTables;
+use App\Http\Controllers\Controller;
class KeluargaController extends Controller
{
@@ -46,10 +47,11 @@ class KeluargaController extends Controller
*/
public function index()
{
- $page_title = 'Keluarga';
+ $page_title = 'Keluarga';
$page_description = 'Daftar Keluarga';
+ $list_desa = DataDesa::get();
- return view('data.keluarga.index', compact('page_title', 'page_description'));
+ return view('data.keluarga.index', compact('page_title', 'page_description', 'list_desa'));
}
/**
@@ -58,14 +60,22 @@ public function index()
public function getKeluarga()
{
if (request()->ajax()) {
- return DataTables::of(Keluarga::has('kepala_kk')->get())
+ $desa = request('desa');
+
+ return DataTables::of(Keluarga::has('kepala_kk')
+ ->when($desa, function ($query) use ($desa) {
+ return $desa === 'Semua'
+ ? $query
+ : $query->where('das_data_desa.desa_id', $desa);
+ })
+ ->get())
->addColumn('aksi', function ($row) {
- $data['show_url'] = route('data.keluarga.show', $row->id);
+ $data['show_url'] = route('data.keluarga.show', $row->id);
return view('forms.aksi', $data);
})
->addColumn('foto', function ($row) {
- return '';
+ return '';
})->editColumn('tgl_cetak_kk', function ($row) {
return format_datetime($row->tgl_cetak_kk);
})
@@ -82,10 +92,10 @@ public function getKeluarga()
*/
public function show($id)
{
- $page_title = 'Detail Keluarga';
+ $page_title = 'Detail Keluarga';
$page_description = 'Detail Data Keluarga';
- $penduduk = Penduduk::select(['nik', 'nama'])->get();
- $keluarga = Keluarga::findOrFail($id);
+ $penduduk = Penduduk::select(['nik', 'nama'])->get();
+ $keluarga = Keluarga::findOrFail($id);
return view('data.keluarga.show', compact('page_title', 'page_description', 'penduduk', 'keluarga'));
}
diff --git a/app/Http/Controllers/Data/LaporanApbdesController.php b/app/Http/Controllers/Data/LaporanApbdesController.php
index 39138e6ea..50fcb8cdd 100644
--- a/app/Http/Controllers/Data/LaporanApbdesController.php
+++ b/app/Http/Controllers/Data/LaporanApbdesController.php
@@ -51,9 +51,9 @@ class LaporanApbdesController extends Controller
*/
public function index(LaporanApbdes $apbdes)
{
- $page_title = 'Laporan APBDes';
+ $page_title = 'Laporan APBDes';
$page_description = 'Daftar Laporan APBDes';
- $list_desa = DataDesa::get();
+ $list_desa = DataDesa::get();
return view('data.laporan-apbdes.index', compact('page_title', 'page_description', 'list_desa'));
}
@@ -61,7 +61,6 @@ public function index(LaporanApbdes $apbdes)
/**
* Return datatable Data Apbdes.
*
- * @param Request $request
* @return DataTables
*/
public function getApbdes(Request $request)
@@ -105,11 +104,12 @@ public function destroy($id)
$apbdes = LaporanApbdes::findOrFail($id);
// Hapus file apbdes
- Storage::disk('public')->delete('apbdes/' . $apbdes->nama_file);
+ Storage::disk('public')->delete('apbdes/'.$apbdes->nama_file);
$apbdes->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.laporan-apbdes.index')->with('error', 'Data gagal dihapus!');
}
@@ -123,7 +123,7 @@ public function destroy($id)
*/
public function import()
{
- $page_title = 'Laporan APBDes';
+ $page_title = 'Laporan APBDes';
$page_description = 'Import Laporan APBDes';
return view('data.laporan-apbdes.import', compact('page_title', 'page_description'));
@@ -160,9 +160,10 @@ public function do_import(Request $request)
// Proses impor excell
(new ImporLaporanApbdes())
- ->queue($extract . basename($fileExtracted[0]));
+ ->queue($extract.basename($fileExtracted[0]));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -172,7 +173,7 @@ public function do_import(Request $request)
/**
* Download the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function download($id)
@@ -180,9 +181,10 @@ public function download($id)
try {
$getFile = LaporanApbdes::findOrFail($id);
- return Storage::download('public/apbdes/' . $getFile->nama_file);
+ return Storage::download('public/apbdes/'.$getFile->nama_file);
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Dokumen tidak ditemukan');
}
}
diff --git a/app/Http/Controllers/Data/LaporanPendudukController.php b/app/Http/Controllers/Data/LaporanPendudukController.php
index aa375dffe..1a57d08cb 100644
--- a/app/Http/Controllers/Data/LaporanPendudukController.php
+++ b/app/Http/Controllers/Data/LaporanPendudukController.php
@@ -51,9 +51,9 @@ class LaporanPendudukController extends Controller
*/
public function index(LaporanPenduduk $penduduk)
{
- $page_title = 'Laporan Penduduk';
+ $page_title = 'Laporan Penduduk';
$page_description = 'Daftar Laporan Penduduk';
- $list_desa = DataDesa::get();
+ $list_desa = DataDesa::get();
return view('data.laporan-penduduk.index', compact('page_title', 'page_description', 'list_desa'));
}
@@ -61,7 +61,6 @@ public function index(LaporanPenduduk $penduduk)
/**
* Return datatable Data Laporan Penduduk.
*
- * @param Request $request
* @return DataTables
*/
public function getData(Request $request)
@@ -88,7 +87,7 @@ public function getData(Request $request)
return DataTables::of($query)
->addColumn('aksi', function ($row) {
$data['delete_url'] = route('data.laporan-penduduk.destroy', $row->id);
- $data['download_url'] = asset('storage/laporan_penduduk/' . $row->nama_file);
+ $data['download_url'] = asset('storage/laporan_penduduk/'.$row->nama_file);
return view('forms.aksi', $data);
})->make();
@@ -105,11 +104,12 @@ public function destroy($id)
$penduduk = LaporanPenduduk::findOrFail($id);
// Hapus file penduduk
- Storage::disk('public')->delete('laporan_penduduk/' . $penduduk->nama_file);
+ Storage::disk('public')->delete('laporan_penduduk/'.$penduduk->nama_file);
$penduduk->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.laporan-penduduk.index')->with('error', 'Data gagal dihapus!');
}
@@ -123,7 +123,7 @@ public function destroy($id)
*/
public function import()
{
- $page_title = 'Laporan Penduduk';
+ $page_title = 'Laporan Penduduk';
$page_description = 'Import Laporan Penduduk';
return view('data.laporan-penduduk.import', compact('page_title', 'page_description'));
@@ -159,9 +159,10 @@ public function do_import(Request $request)
// Proses impor excell
(new ImporLaporanPenduduk())
- ->queue($extract . basename($fileExtracted[0]));
+ ->queue($extract.basename($fileExtracted[0]));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
diff --git a/app/Http/Controllers/Data/PendudukController.php b/app/Http/Controllers/Data/PendudukController.php
index 1532fcccd..a0ac526c9 100644
--- a/app/Http/Controllers/Data/PendudukController.php
+++ b/app/Http/Controllers/Data/PendudukController.php
@@ -49,9 +49,9 @@ class PendudukController extends Controller
*/
public function index(Penduduk $penduduk)
{
- $page_title = 'Penduduk';
+ $page_title = 'Penduduk';
$page_description = 'Data Penduduk';
- $list_desa = DataDesa::get();
+ $list_desa = DataDesa::get();
return view('data.penduduk.index', compact('page_title', 'page_description', 'list_desa'));
}
@@ -59,7 +59,6 @@ public function index(Penduduk $penduduk)
/**
* Return datatable Data Penduduk.
*
- * @param Request $request
* @return DataTables
*/
public function getPenduduk(Request $request)
@@ -95,12 +94,12 @@ public function getPenduduk(Request $request)
return DataTables::of($query)
->addColumn('aksi', function ($row) {
- $data['show_url'] = route('data.penduduk.show', $row->id);
+ $data['show_url'] = route('data.penduduk.show', $row->id);
return view('forms.aksi', $data);
})
->addColumn('foto', function ($row) {
- return '';
+ return '';
})
->addColumn('tanggal_lahir', function ($row) {
return convert_born_date_to_age($row->tanggal_lahir);
@@ -112,14 +111,14 @@ public function getPenduduk(Request $request)
/**
* Show the specified resource.
*
- * @param Penduduk $penduduk
+ * @param Penduduk $penduduk
* @return Response
*/
public function show($id)
{
- $penduduk = Penduduk::findOrFail($id);
- $page_title = 'Detail Penduduk';
- $page_description = 'Detail Data Penduduk: ' . ucwords(strtolower($penduduk->nama));
+ $penduduk = Penduduk::findOrFail($id);
+ $page_title = 'Detail Penduduk';
+ $page_description = 'Detail Data Penduduk: '.ucwords(strtolower($penduduk->nama));
return view('data.penduduk.show', compact('page_title', 'page_description', 'penduduk'));
}
@@ -131,9 +130,9 @@ public function show($id)
*/
public function import()
{
- $page_title = 'Impor';
+ $page_title = 'Impor';
$page_description = 'Impor Data Penduduk';
- $list_desa = DataDesa::all();
+ $list_desa = DataDesa::all();
return view('data.penduduk.import', compact('page_title', 'page_description', 'list_desa'));
}
@@ -169,10 +168,11 @@ public function importExcel(Request $request)
// Proses impor excell
(new ImporPendudukKeluarga())
- ->queue($extract . basename($fileExtracted[0]));
+ ->queue($extract.basename($fileExtracted[0]));
} catch (\Exception $e) {
report($e);
- return back()->with('error', 'Import data gagal. '. $e->getMessage());
+
+ return back()->with('error', 'Import data gagal. '.$e->getMessage());
}
return redirect()->route('data.penduduk.index')->with('success', 'Import data sukses.');
diff --git a/app/Http/Controllers/Data/PengurusController.php b/app/Http/Controllers/Data/PengurusController.php
index 50cb53db3..7230a75e5 100644
--- a/app/Http/Controllers/Data/PengurusController.php
+++ b/app/Http/Controllers/Data/PengurusController.php
@@ -53,7 +53,7 @@ class PengurusController extends Controller
*/
public function index(Request $request)
{
- $page_title = 'Data Pengurus';
+ $page_title = 'Data Pengurus';
$page_description = 'Daftar Data Pengurus';
if ($request->ajax()) {
@@ -62,8 +62,8 @@ public function index(Request $request)
return DataTables::of(Pengurus::where('status', $status))
->addIndexColumn()
->addColumn('aksi', function ($row) {
- if (!auth()->guest()) {
- $data['edit_url'] = route('data.pengurus.edit', $row->id);
+ 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) {
$data['suspend_url'] = route('data.pengurus.lock', [$row->id, Status::TidakAktif]);
@@ -75,16 +75,17 @@ public function index(Request $request)
return view('forms.aksi', $data);
})
->editColumn('foto', function ($row) {
- return '';
+ return '';
})
->editColumn('identitas', function ($row) {
- return $row->namaGelar . ',
NIP: ' . $row->nip . ',
NIK: ' . $row->nik;
+ return $row->namaGelar.',
NIP: '.$row->nip.',
NIK: '.$row->nik;
})
->editColumn('ttl', function ($row) {
- return $row->tempat_lahir . ',' . format_date($row->tanggal_lahir);
+ return $row->tempat_lahir.','.format_date($row->tanggal_lahir);
})
->editColumn('sex', function ($row) {
$sex = ['1' => 'Laki-laki', '2' => 'Perempuan'];
+
return $sex[$row->sex];
})
->editColumn('tanggal_sk', function ($row) {
@@ -114,13 +115,13 @@ public function index(Request $request)
*/
public function create()
{
- $page_title = 'Pengurus';
+ $page_title = 'Pengurus';
$page_description = 'Tambah Pengurus';
- $pendidikan = PendidikanKK::pluck('nama', 'id');
- $agama = Agama::pluck('nama', 'id');
- $pengurus = new Pengurus();
- $kecuali = $pengurus->cekPengurus();
- $jabatan = Jabatan::whereNotIn('id', $kecuali)->pluck('nama', 'id');
+ $pendidikan = PendidikanKK::pluck('nama', 'id');
+ $agama = Agama::pluck('nama', 'id');
+ $pengurus = new Pengurus();
+ $kecuali = $pengurus->cekPengurus();
+ $jabatan = Jabatan::whereNotIn('id', $kecuali)->pluck('nama', 'id');
return view('data.pengurus.create', compact('page_title', 'page_description', 'pendidikan', 'agama', 'jabatan'));
}
@@ -135,15 +136,16 @@ public function store(PengurusRequest $request)
try {
$input = $request->all();
if ($request->hasFile('foto')) {
- $file = $request->file('foto');
- $original_name = strtolower(trim($file->getClientOriginalName()));
- $file_name = time() . '_' . $original_name;
+ $file = $request->file('foto');
+ $original_name = strtolower(trim($file->getClientOriginalName()));
+ $file_name = time().'_'.$original_name;
Storage::putFileAs('public/pengurus', $file, $file_name);
- $input['foto'] = $file_name;
+ $input['foto'] = $file_name;
}
Pengurus::create($input);
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Pengurus gagal ditambah!');
}
@@ -153,17 +155,17 @@ public function store(PengurusRequest $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $pengurus = Pengurus::findOrFail($id);
- $page_title = 'Pengurus';
- $page_description = 'Ubah Pengurus : ' . $pengurus->nama;
- $pendidikan = PendidikanKK::pluck('nama', 'id');
- $agama = Agama::pluck('nama', 'id');
- $kecuali = $pengurus->cekPengurus();
+ $pengurus = Pengurus::findOrFail($id);
+ $page_title = 'Pengurus';
+ $page_description = 'Ubah Pengurus : '.$pengurus->nama;
+ $pendidikan = PendidikanKK::pluck('nama', 'id');
+ $agama = Agama::pluck('nama', 'id');
+ $kecuali = $pengurus->cekPengurus();
$jabatan = Jabatan::whereNotIn('id', $kecuali)->orWhere('jenis', $pengurus->jabatan->jenis)
->pluck('nama', 'id');
@@ -174,10 +176,9 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
-
public function update(PengurusRequest $request, $id)
{
$pengurus = Pengurus::findOrFail($id);
@@ -186,19 +187,20 @@ public function update(PengurusRequest $request, $id)
$input = $request->all();
if ($request->hasFile('foto')) {
- $file = $request->file('foto');
- $original_name = strtolower(trim($file->getClientOriginalName()));
- $file_name = time() . '_' . $original_name;
+ $file = $request->file('foto');
+ $original_name = strtolower(trim($file->getClientOriginalName()));
+ $file_name = time().'_'.$original_name;
Storage::putFileAs('public/pengurus', $file, $file_name);
if ($pengurus->foto) {
- Storage::delete('public/pengurus/' . $pengurus->getRawOriginal('foto'));
+ Storage::delete('public/pengurus/'.$pengurus->getRawOriginal('foto'));
}
- $input['foto'] = $file_name;
+ $input['foto'] = $file_name;
}
$pengurus->update($input);
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Pengurus gagal diubah!');
}
@@ -208,7 +210,7 @@ public function update(PengurusRequest $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -216,11 +218,12 @@ public function destroy($id)
try {
$pengurus = Pengurus::findOrFail($id);
if ($pengurus->foto) {
- Storage::delete('public/pengurus/' . $pengurus->getRawOriginal('foto'));
+ Storage::delete('public/pengurus/'.$pengurus->getRawOriginal('foto'));
}
$pengurus->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.pengurus.index')->with('error', 'Pengurus gagal dihapus!');
}
@@ -230,7 +233,7 @@ public function destroy($id)
/**
* Update status resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function lock($id, $status)
@@ -251,6 +254,7 @@ public function lock($id, $status)
$pengurus->update(['status' => $status]);
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.pengurus.index')->with('error', 'Status Pengurus gagal diubah!');
}
diff --git a/app/Http/Controllers/Data/ProfilController.php b/app/Http/Controllers/Data/ProfilController.php
index 491828e99..3bdfd10e9 100644
--- a/app/Http/Controllers/Data/ProfilController.php
+++ b/app/Http/Controllers/Data/ProfilController.php
@@ -46,18 +46,19 @@ class ProfilController extends Controller
*/
public function index()
{
- $profil = $this->profil;
- $page_title = 'Profil';
+ $profil = $this->profil;
+ $page_title = 'Profil';
$page_description = 'Data Profil';
- $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
+ $status_pantau = checkWebsiteAccessibility(config('app.server_pantau')) ? 1 : 0;
+ $adaDesa = DataUmum::where('profil_id', $profil->id)->exists() && $profil->provinsi_id != null;
- return view('data.profil.edit', compact('page_title', 'page_description', 'profil', 'status_pantau'));
+ return view('data.profil.edit', compact('page_title', 'page_description', 'profil', 'status_pantau', 'adaDesa'));
}
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(ProfilRequest $request, $id)
@@ -68,28 +69,29 @@ public function update(ProfilRequest $request, $id)
$dataumum = DataUmum::where('profil_id', $id)->first();
- if ($request->file('file_struktur_organisasi') == "") {
+ if ($request->file('file_struktur_organisasi') == '') {
$profil->file_struktur_organisasi = $profil->file_struktur_organisasi;
} else {
- $file = $request->file('file_struktur_organisasi');
+ $file = $request->file('file_struktur_organisasi');
$fileName = $file->getClientOriginalName();
- $request->file('file_struktur_organisasi')->move("storage/profil/struktur_organisasi/", $fileName);
- $profil->file_struktur_organisasi = 'storage/profil/struktur_organisasi/' . $fileName;
+ $request->file('file_struktur_organisasi')->move('storage/profil/struktur_organisasi/', $fileName);
+ $profil->file_struktur_organisasi = 'storage/profil/struktur_organisasi/'.$fileName;
}
- if ($request->file('file_logo') == "") {
+ if ($request->file('file_logo') == '') {
$profil->file_logo = $profil->file_logo;
} else {
- $fileLogo = $request->file('file_logo');
+ $fileLogo = $request->file('file_logo');
$fileLogoName = $fileLogo->getClientOriginalName();
- $request->file('file_logo')->move("storage/profil/file_logo/", $fileLogoName);
- $profil->file_logo = 'storage/profil/file_logo/' . $fileLogoName;
+ $request->file('file_logo')->move('storage/profil/file_logo/', $fileLogoName);
+ $profil->file_logo = 'storage/profil/file_logo/'.$fileLogoName;
}
$profil->update();
$dataumum->update();
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Update Profil gagal!');
}
@@ -99,12 +101,12 @@ public function update(ProfilRequest $request, $id)
/**
* Redirect to edit Data Umum if success
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function success($id)
{
- $page_title = 'Profil';
+ $page_title = 'Profil';
$page_description = 'Konfirmasi?';
return view('data.profil.save_success', compact('id', 'page_title', 'page_description'));
diff --git a/app/Http/Controllers/Data/ProgramBantuanController.php b/app/Http/Controllers/Data/ProgramBantuanController.php
index cf51b82ee..210ca235b 100644
--- a/app/Http/Controllers/Data/ProgramBantuanController.php
+++ b/app/Http/Controllers/Data/ProgramBantuanController.php
@@ -45,26 +45,27 @@ class ProgramBantuanController extends Controller
{
public function index()
{
- $page_title = 'Program Bantuan';
+ $page_title = 'Program Bantuan';
$page_description = 'Daftar Program Bantuan';
- $list_desa = DataDesa::all();
+ $list_desa = DataDesa::all();
return view('data.program_bantuan.index', compact('page_title', 'page_description', 'list_desa'));
}
public function getaProgramBantuan(Request $request)
{
- return DataTables::of(Program::when(!empty($request->input('desa')), fn ($q) => $q->where('desa_id', $request->desa))->with('desa'))
+ return DataTables::of(Program::when(! empty($request->input('desa')), fn ($q) => $q->where('desa_id', $request->desa))->with('desa'))
->addColumn('aksi', function ($row) {
$data['detail_url'] = route('data.program-bantuan.show', [$row->id, $row->desa_id]);
return view('forms.aksi', $data);
})
->addColumn('masa_berlaku', function ($row) {
- return format_date($row->start_date) . ' - ' . format_date($row->end_date);
+ return format_date($row->start_date).' - '.format_date($row->end_date);
})
->editColumn('sasaran', function ($row) {
$sasaran = [1 => 'Penduduk/Perorangan', 2 => 'Keluarga-KK'];
+
return $sasaran[$row->sasaran];
})
->rawColumns(['aksi'])->make();
@@ -72,18 +73,18 @@ public function getaProgramBantuan(Request $request)
public function show($id, $desa_id)
{
- $program = Program::with('desa')->findOrFail($id);
- $page_title = 'Detail Program';
- $page_description = 'Program Bantuan ' . $program->nama;
- $sasaran = [1 => 'Penduduk/Perorangan', 2 => 'Keluarga-KK'];
- $peserta = PesertaProgram::where('program_id', $id)->where('desa_id', $desa_id)->get();
+ $program = Program::with('desa')->findOrFail($id);
+ $page_title = 'Detail Program';
+ $page_description = 'Program Bantuan '.$program->nama;
+ $sasaran = [1 => 'Penduduk/Perorangan', 2 => 'Keluarga-KK'];
+ $peserta = PesertaProgram::where('program_id', $id)->where('desa_id', $desa_id)->get();
return view('data.program_bantuan.show', compact('page_title', 'page_description', 'program', 'sasaran', 'peserta'));
}
public function import()
{
- $page_title = 'Impor';
+ $page_title = 'Impor';
$page_description = 'Impor Data Program Bantuan';
return view('data.program_bantuan.import', compact('page_title', 'page_description'));
@@ -113,12 +114,13 @@ public function do_import(Request $request)
glob($extract.'*.csv');
(new SinkronBantuan())
- ->queue($extract . Str::replaceLast('zip', 'csv', $name));
+ ->queue($extract.Str::replaceLast('zip', 'csv', $name));
(new SinkronPesertaBantuan())
- ->queue($extract . Str::replaceLast('zip', 'csv', 'peserta_'.$name));
+ ->queue($extract.Str::replaceLast('zip', 'csv', 'peserta_'.$name));
} catch (\Exception $e) {
report($e);
- return back()->with('error', 'Import data gagal. '. $e->getMessage());
+
+ return back()->with('error', 'Import data gagal. '.$e->getMessage());
}
return redirect()->route('data.program-bantuan.index')->with('success', 'Import data sukses.');
diff --git a/app/Http/Controllers/Data/PutusSekolahController.php b/app/Http/Controllers/Data/PutusSekolahController.php
index d70114fb1..dd25141d1 100644
--- a/app/Http/Controllers/Data/PutusSekolahController.php
+++ b/app/Http/Controllers/Data/PutusSekolahController.php
@@ -42,7 +42,7 @@ class PutusSekolahController extends Controller
{
public function index()
{
- $page_title = 'Siswa Putus Sekolah';
+ $page_title = 'Siswa Putus Sekolah';
$page_description = 'Daftar Siswa Putus Sekolah';
return view('data.putus_sekolah.index', compact('page_title', 'page_description'));
@@ -57,7 +57,7 @@ public function getDataPutusSekolah()
{
return DataTables::of(PutusSekolah::with(['desa'])->get())
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.putus-sekolah.edit', $row->id);
+ $data['edit_url'] = route('data.putus-sekolah.edit', $row->id);
$data['delete_url'] = route('data.putus-sekolah.destroy', $row->id);
return view('forms.aksi', $data);
@@ -72,10 +72,10 @@ public function getDataPutusSekolah()
*/
public function import()
{
- $page_title = 'Siswa Putus Sekolah';
+ $page_title = 'Siswa Putus Sekolah';
$page_description = 'Import Siswa Putus Sekolah ';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.putus_sekolah.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -88,9 +88,9 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'desa_id' => 'required|unique:das_putus_sekolah,desa_id',
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
- 'tahun' => 'required|unique:das_putus_sekolah',
+ 'desa_id' => 'required|unique:das_putus_sekolah,desa_id',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'tahun' => 'required|unique:das_putus_sekolah',
'semester' => 'required|unique:das_putus_sekolah',
]);
@@ -99,6 +99,7 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -108,14 +109,14 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $siswa = PutusSekolah::with(['desa'])->findOrFail($id);
- $page_title = 'Siswa Putus Sekolah';
- $page_description = 'Ubah Siswa Putus Sekolah : Desa ' . $siswa->desa->nama;
+ $siswa = PutusSekolah::with(['desa'])->findOrFail($id);
+ $page_title = 'Siswa Putus Sekolah';
+ $page_description = 'Ubah Siswa Putus Sekolah : Desa '.$siswa->desa->nama;
return view('data.putus_sekolah.edit', compact('page_title', 'page_description', 'siswa'));
}
@@ -123,28 +124,29 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
request()->validate([
- 'siswa_paud' => 'required',
+ 'siswa_paud' => 'required',
'anak_usia_paud' => 'required',
- 'siswa_sd' => 'required',
- 'anak_usia_sd' => 'required',
- 'siswa_smp' => 'required',
- 'anak_usia_smp' => 'required',
- 'siswa_sma' => 'required',
- 'anak_usia_sma' => 'required',
- 'semester' => 'required',
- 'tahun' => 'required',
+ 'siswa_sd' => 'required',
+ 'anak_usia_sd' => 'required',
+ 'siswa_smp' => 'required',
+ 'anak_usia_smp' => 'required',
+ 'siswa_sma' => 'required',
+ 'anak_usia_sma' => 'required',
+ 'semester' => 'required',
+ 'tahun' => 'required',
]);
try {
PutusSekolah::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal diubah!');
}
@@ -154,7 +156,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -163,6 +165,7 @@ public function destroy($id)
PutusSekolah::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.putus-sekolah.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/SuplemenController.php b/app/Http/Controllers/Data/SuplemenController.php
index 993027afc..0e37e00ec 100644
--- a/app/Http/Controllers/Data/SuplemenController.php
+++ b/app/Http/Controllers/Data/SuplemenController.php
@@ -49,7 +49,7 @@ class SuplemenController extends Controller
*/
public function index()
{
- $page_title = 'Data Suplemen';
+ $page_title = 'Data Suplemen';
$page_description = 'Daftar Data Suplemen';
return view('data.data_suplemen.index', compact('page_title', 'page_description'));
@@ -66,8 +66,8 @@ public function getDataSuplemen()
->addColumn('aksi', function ($row) {
$data['detail_url'] = route('data.data-suplemen.show', $row->id);
- if (!auth()->guest()) {
- $data['edit_url'] = route('data.data-suplemen.edit', $row->id);
+ if (! auth()->guest()) {
+ $data['edit_url'] = route('data.data-suplemen.edit', $row->id);
$data['delete_url'] = route('data.data-suplemen.destroy', $row->id);
}
@@ -75,6 +75,7 @@ public function getDataSuplemen()
})
->editColumn('sasaran', function ($row) {
$sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
+
return $sasaran[$row->sasaran];
})
->make();
@@ -88,7 +89,7 @@ public function getDataSuplemen()
*/
public function create()
{
- $page_title = 'Data Suplemen';
+ $page_title = 'Data Suplemen';
$page_description = 'Tambah Data Suplemen';
return view('data.data_suplemen.create', compact('page_title', 'page_description'));
@@ -97,7 +98,6 @@ public function create()
/**
* Store a newly created resource in storage.
*
- * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@@ -112,6 +112,7 @@ public function store(Request $request)
Suplemen::create($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data Suplemen gagal ditambah!');
}
@@ -126,9 +127,9 @@ public function store(Request $request)
*/
public function edit($id)
{
- $suplemen = Suplemen::findOrFail($id);
- $page_title = 'Data Suplemen';
- $page_description = 'Ubah Data Suplemen : ' . $suplemen->nama;
+ $suplemen = Suplemen::findOrFail($id);
+ $page_title = 'Data Suplemen';
+ $page_description = 'Ubah Data Suplemen : '.$suplemen->nama;
return view('data.data_suplemen.edit', compact('page_title', 'page_description', 'suplemen'));
}
@@ -136,7 +137,6 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
@@ -152,6 +152,7 @@ public function update(Request $request, $id)
Suplemen::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data Suplemen gagal diubah!');
}
@@ -174,6 +175,7 @@ public function destroy($id)
Suplemen::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.data-suplemen.index')->with('error', 'Data Suplemen gagal dihapus!');
}
@@ -188,10 +190,10 @@ public function destroy($id)
*/
public function show($id)
{
- $suplemen = Suplemen::findOrFail($id);
- $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
- $page_title = 'Anggota Suplemen';
- $page_description = 'Anggota Suplemen: ' . ucwords(strtolower($suplemen->nama));
+ $suplemen = Suplemen::findOrFail($id);
+ $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
+ $page_title = 'Anggota Suplemen';
+ $page_description = 'Anggota Suplemen: '.ucwords(strtolower($suplemen->nama));
return view('data.data_suplemen.show', compact('page_title', 'page_description', 'suplemen', 'sasaran'));
}
@@ -205,8 +207,8 @@ public function getDataSuplemenTerdata($id_terdata)
return DataTables::of(SuplemenTerdata::with('penduduk', 'penduduk.desa')->where('suplemen_id', $id_terdata)->get())
->addIndexColumn()
->addColumn('aksi', function ($row) {
- if (!auth()->guest()) {
- $data['edit_url'] = route('data.data-suplemen.editdetail', [$row->id, $row->suplemen_id]);
+ if (! auth()->guest()) {
+ $data['edit_url'] = route('data.data-suplemen.editdetail', [$row->id, $row->suplemen_id]);
$data['delete_url'] = route('data.data-suplemen.destroydetail', [$row->id, $row->suplemen_id]);
}
@@ -214,6 +216,7 @@ public function getDataSuplemenTerdata($id_terdata)
})
->editColumn('penduduk.sex', function ($row) {
$sex = ['1' => 'Laki-laki', '2' => 'Perempuan'];
+
return $sex[$row->penduduk->sex];
})
->make();
@@ -233,6 +236,7 @@ public function getPenduduk($desa, $suplemen)
}
$data = Penduduk::where('desa_id', $desa)->whereNotIn('id', $penduduk)->get();
+
return response()->json($data);
}
@@ -243,12 +247,12 @@ public function getPenduduk($desa, $suplemen)
*/
public function createDetail($id_suplemen)
{
- $suplemen = Suplemen::findOrFail($id_suplemen);
- $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
- $page_title = 'Anggota Suplemen';
+ $suplemen = Suplemen::findOrFail($id_suplemen);
+ $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
+ $page_title = 'Anggota Suplemen';
$page_description = 'Tambah Anggota Suplemen';
- $desa = DataDesa::all();
- $anggota = null;
+ $desa = DataDesa::all();
+ $anggota = null;
if ($suplemen->sasaran == 1) {
$data = Penduduk::get();
@@ -262,13 +266,12 @@ public function createDetail($id_suplemen)
/**
* Store a newly created resource in storage.
*
- * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function storeDetail(Request $request)
{
request()->validate(
- ['penduduk_id' => 'required',],
+ ['penduduk_id' => 'required'],
['penduduk_id.required' => 'isian warga atau penduduk wajib diisi']
);
@@ -276,6 +279,7 @@ public function storeDetail(Request $request)
SuplemenTerdata::create($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Anggota Suplemen gagal ditambah!');
}
@@ -290,13 +294,13 @@ public function storeDetail(Request $request)
*/
public function editDetail($id, $id_suplemen)
{
- $suplemen = Suplemen::findOrFail($id_suplemen);
- $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
- $page_title = 'Anggota Suplemen';
+ $suplemen = Suplemen::findOrFail($id_suplemen);
+ $sasaran = ['1' => 'Penduduk', '2' => 'Keluarga/KK'];
+ $page_title = 'Anggota Suplemen';
$page_description = 'Ubah Anggota Suplemen';
- $anggota = SuplemenTerdata::with('penduduk', 'penduduk.desa')->where('id', $id)->first();
- $data = Penduduk::where('id', $anggota->penduduk_id)->get();
- $desa = DataDesa::all();
+ $anggota = SuplemenTerdata::with('penduduk', 'penduduk.desa')->where('id', $id)->first();
+ $data = Penduduk::where('id', $anggota->penduduk_id)->get();
+ $desa = DataDesa::all();
return view('data.data_suplemen.edit_detail', compact('page_title', 'page_description', 'suplemen', 'sasaran', 'data', 'desa', 'anggota'));
}
@@ -304,7 +308,6 @@ public function editDetail($id, $id_suplemen)
/**
* Update the specified resource in storage.
*
- * @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
@@ -314,6 +317,7 @@ public function updateDetail(Request $request, $id)
SuplemenTerdata::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Anggota Suplemen gagal diubah!');
}
@@ -332,6 +336,7 @@ public function destroyDetail($id, $id_suplemen)
SuplemenTerdata::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.data-suplemen.show', $id_suplemen)->with('error', 'Anggota Suplemen gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/TingkatPendidikanController.php b/app/Http/Controllers/Data/TingkatPendidikanController.php
index e9de28625..bb26e46ab 100644
--- a/app/Http/Controllers/Data/TingkatPendidikanController.php
+++ b/app/Http/Controllers/Data/TingkatPendidikanController.php
@@ -42,7 +42,7 @@ class TingkatPendidikanController extends Controller
{
public function index()
{
- $page_title = 'Tingkat Pendidikan';
+ $page_title = 'Tingkat Pendidikan';
$page_description = 'Daftar Tingkat Pendidikan';
return view('data.tingkat_pendidikan.index', compact('page_title', 'page_description'));
@@ -55,13 +55,24 @@ public function index()
*/
public function getData()
{
- return DataTables::of(TingkatPendidikan::with(['desa'])->get())
- ->addColumn('aksi', function ($row) {
- $data['delete_url'] = route('data.tingkat-pendidikan.destroy', $row->id);
+ if (request()->ajax()) {
+ $desa = request()->input('desa');
- return view('forms.aksi', $data);
- })
- ->rawColumns(['aksi'])->make();
+ return DataTables::of(
+ TingkatPendidikan::when($desa && $desa !== 'Semua', function ($query) use ($desa) {
+ return $query->where('desa_id', $desa);
+ })
+ ->with('desa')
+ ->get()
+ )
+ ->addColumn('aksi', function ($row) {
+ $data['delete_url'] = route('data.tingkat-pendidikan.destroy', $row->id);
+
+ return view('forms.aksi', $data);
+ })
+ ->rawColumns(['aksi'])
+ ->make();
+ }
}
/**
@@ -71,10 +82,10 @@ public function getData()
*/
public function import()
{
- $page_title = 'Tingkat Pendidikan';
+ $page_title = 'Tingkat Pendidikan';
$page_description = 'Import Tingkat Pendidikan';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.tingkat_pendidikan.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -91,6 +102,7 @@ public function do_import(TingkatPendidikanRequest $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Data gagal diimpor');
}
@@ -100,7 +112,7 @@ public function do_import(TingkatPendidikanRequest $request)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -109,6 +121,7 @@ public function destroy($id)
TingkatPendidikan::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.tingkat-pendidikan.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Data/ToiletSanitasiController.php b/app/Http/Controllers/Data/ToiletSanitasiController.php
index ea15b9cba..12b5b4d46 100644
--- a/app/Http/Controllers/Data/ToiletSanitasiController.php
+++ b/app/Http/Controllers/Data/ToiletSanitasiController.php
@@ -36,7 +36,6 @@
use App\Models\ToiletSanitasi;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
-
use Yajra\DataTables\Facades\DataTables;
class ToiletSanitasiController extends Controller
@@ -48,7 +47,7 @@ class ToiletSanitasiController extends Controller
*/
public function index()
{
- $page_title = 'Toilet & Sanitasi';
+ $page_title = 'Toilet & Sanitasi';
$page_description = 'Daftar Toilet & Sanitasi';
return view('data.toilet_sanitasi.index', compact('page_title', 'page_description'));
@@ -63,7 +62,7 @@ public function getDataAKIAKB()
{
return DataTables::of(ToiletSanitasi::with(['desa']))
->addColumn('aksi', function ($row) {
- $data['edit_url'] = route('data.toilet-sanitasi.edit', $row->id);
+ $data['edit_url'] = route('data.toilet-sanitasi.edit', $row->id);
$data['delete_url'] = route('data.toilet-sanitasi.destroy', $row->id);
return view('forms.aksi', $data);
@@ -81,10 +80,10 @@ public function getDataAKIAKB()
*/
public function import()
{
- $page_title = 'Toilet & Sanitasi';
+ $page_title = 'Toilet & Sanitasi';
$page_description = 'Import Toilet & Sanitasi';
- $years_list = years_list();
- $months_list = months_list();
+ $years_list = years_list();
+ $months_list = months_list();
return view('data.toilet_sanitasi.import', compact('page_title', 'page_description', 'years_list', 'months_list'));
}
@@ -97,7 +96,7 @@ public function import()
public function do_import(Request $request)
{
$this->validate($request, [
- 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
+ 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120',
'bulan' => 'required|unique:das_toilet_sanitasi',
'tahun' => 'required|unique:das_toilet_sanitasi',
]);
@@ -107,6 +106,7 @@ public function do_import(Request $request)
->queue($request->file('file'));
} catch (\Exception $e) {
report($e);
+
return back()->with('error', 'Import data gagal.');
}
@@ -116,14 +116,14 @@ public function do_import(Request $request)
/**
* Show the form for editing the specified resource.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function edit($id)
{
- $toilet = ToiletSanitasi::with(['desa'])->findOrFail($id);
- $page_title = 'Toilet & Sanitasi';
- $page_description = 'Ubah Toilet & Sanitasi : ' . $toilet->desa->nama;
+ $toilet = ToiletSanitasi::with(['desa'])->findOrFail($id);
+ $page_title = 'Toilet & Sanitasi';
+ $page_description = 'Ubah Toilet & Sanitasi : '.$toilet->desa->nama;
return view('data.toilet_sanitasi.edit', compact('page_title', 'page_description', 'toilet'));
}
@@ -131,13 +131,13 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
request()->validate([
- 'toilet' => 'required',
+ 'toilet' => 'required',
'sanitasi' => 'required',
]);
@@ -145,6 +145,7 @@ public function update(Request $request, $id)
ToiletSanitasi::findOrFail($id)->update($request->all());
} catch (\Exception $e) {
report($e);
+
return back()->withInput()->with('error', 'Data gagal diubah!');
}
@@ -154,7 +155,7 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
*
- * @param int $id
+ * @param int $id
* @return Response
*/
public function destroy($id)
@@ -163,6 +164,7 @@ public function destroy($id)
ToiletSanitasi::findOrFail($id)->delete();
} catch (\Exception $e) {
report($e);
+
return redirect()->route('data.toilet-sanitasi.index')->with('error', 'Data gagal dihapus!');
}
diff --git a/app/Http/Controllers/Page/AnggaranDesaController.php b/app/Http/Controllers/FrontEnd/AnggaranDesaController.php
similarity index 76%
rename from app/Http/Controllers/Page/AnggaranDesaController.php
rename to app/Http/Controllers/FrontEnd/AnggaranDesaController.php
index d190748f6..e8e572ffe 100644
--- a/app/Http/Controllers/Page/AnggaranDesaController.php
+++ b/app/Http/Controllers/FrontEnd/AnggaranDesaController.php
@@ -29,49 +29,49 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\CoaType;
use App\Models\DataDesa;
use Illuminate\Support\Facades\DB;
-class AnggaranDesaController extends Controller
+class AnggaranDesaController extends FrontEndController
{
/**
* Menampilkan Data Anggaran Dan realisasi Kecamatan
**/
public function showAnggaranDesa()
{
- $data['page_title'] = 'Anggaran Desa (APBDes)';
+ $data['page_title'] = 'Anggaran Desa (APBDes)';
$data['page_description'] = 'Data Anggaran Desa (APBDes)';
- $data['year_list'] = years_list();
- $data['list_desa'] = DataDesa::all();
+ $data['year_list'] = years_list();
+ $data['list_desa'] = DataDesa::all();
return view('pages.anggaran_desa.show_anggaran_desa')->with($data);
}
public function getChartAnggaranDesa()
{
- $mid = request('mid');
- $did = request('did');
+ $mid = request('mid');
+ $did = request('did');
$year = request('y');
// Grafik Data Pendidikan
$data_anggaran = [];
- $type = CoaType::all();
+ $type = CoaType::all();
if ($mid == 'Semua' && $year == 'Semua') {
$tmp = [];
foreach ($type as $val) {
$query_anggaran = DB::table('das_anggaran_desa')->select('*')
- ->where('no_akun', 'LIKE', $val->id . '%');
+ ->where('no_akun', 'LIKE', $val->id.'%');
if ($did != 'Semua') {
$query_anggaran->where('desa_id', $did);
}
$tmp[] = [
- 'anggaran' => $val->id . ' - ' . $val->type_name,
- 'jumlah' => $query_anggaran->sum('jumlah'),
+ 'anggaran' => $val->id.' - '.$val->type_name,
+ 'jumlah' => $query_anggaran->sum('jumlah'),
];
}
@@ -80,14 +80,14 @@ public function getChartAnggaranDesa()
$tmp = [];
foreach ($type as $val) {
$query_anggaran = DB::table('das_anggaran_desa')->select('*')
- ->where('no_akun', 'LIKE', $val->id . '%')
+ ->where('no_akun', 'LIKE', $val->id.'%')
->where('bulan', $mid);
if ($did != 'Semua') {
$query_anggaran->where('desa_id', $did);
}
$tmp[] = [
- 'anggaran' => $val->id . ' - ' . $val->type_name,
- 'jumlah' => $query_anggaran->sum('jumlah'),
+ 'anggaran' => $val->id.' - '.$val->type_name,
+ 'jumlah' => $query_anggaran->sum('jumlah'),
];
}
@@ -96,14 +96,14 @@ public function getChartAnggaranDesa()
$tmp = [];
foreach ($type as $val) {
$query_anggaran = DB::table('das_anggaran_desa')->select('*')
- ->where('no_akun', 'LIKE', $val->id . '%')
+ ->where('no_akun', 'LIKE', $val->id.'%')
->where('tahun', $year);
if ($did != 'Semua') {
$query_anggaran->where('desa_id', $did);
}
$tmp[] = [
- 'anggaran' => $val->id . ' - ' . $val->type_name,
- 'jumlah' => $query_anggaran->sum('jumlah'),
+ 'anggaran' => $val->id.' - '.$val->type_name,
+ 'jumlah' => $query_anggaran->sum('jumlah'),
];
}
$data_anggaran['grafik'] = $tmp;
@@ -111,20 +111,21 @@ public function getChartAnggaranDesa()
$tmp = [];
foreach ($type as $val) {
$query_anggaran = DB::table('das_anggaran_desa')->select('*')
- ->where('no_akun', 'LIKE', $val->id . '%')
+ ->where('no_akun', 'LIKE', $val->id.'%')
->where('bulan', $mid)
->where('tahun', $year);
if ($did != 'Semua') {
$query_anggaran->where('desa_id', $did);
}
$tmp[] = [
- 'anggaran' => $val->id . ' - ' . $val->type_name,
- 'jumlah' => $query_anggaran->sum('jumlah'),
+ 'anggaran' => $val->id.' - '.$val->type_name,
+ 'jumlah' => $query_anggaran->sum('jumlah'),
];
}
$data_anggaran['grafik'] = $tmp;
}
$data_anggaran['detail'] = view('pages.anggaran_desa.detail_anggaran', compact('did', 'mid', 'year'))->render();
+
return $data_anggaran;
}
}
diff --git a/app/Http/Controllers/FrontEnd/AnggaranRealisasiController.php b/app/Http/Controllers/FrontEnd/AnggaranRealisasiController.php
new file mode 100644
index 000000000..e9d1c3548
--- /dev/null
+++ b/app/Http/Controllers/FrontEnd/AnggaranRealisasiController.php
@@ -0,0 +1,198 @@
+with($data);
+ }
+
+ // TODO : Sederhanakan, buat jadi 1 kondisi yg lebih fleksibel.
+ public function getChartAnggaranRealisasi()
+ {
+ $mid = request('mid');
+ $year = request('y');
+
+ // Grafik Data Pendidikan
+ $data_pendidikan = [];
+ if ($year == 'Semua') {
+ $total_anggaran = 0;
+ $total_belanja = 0;
+ $belanja_pegawai = 0;
+ $belanja_barang_jasa = 0;
+ $belanja_modal = 0;
+ $belanja_tidak_langsung = 0;
+
+ foreach (array_sort(years_list()) as $yearls) {
+ $query_result = DB::table('das_anggaran_realisasi')
+ ->select('*')
+ ->where('profil_id', '=', $this->profil->id);
+ if ($mid != 'Semua') {
+ $query_result->where('bulan', '=', $mid);
+ }
+ $query_result->where('tahun', '=', $yearls);
+
+ $res = $query_result->first();
+
+ if (! empty($res)) {
+ $total_anggaran = $res->total_anggaran;
+ $total_belanja = $res->total_belanja;
+ $belanja_pegawai = $res->belanja_pegawai;
+ $belanja_barang_jasa = $res->belanja_barang_jasa;
+ $belanja_modal = $res->belanja_modal;
+ $belanja_tidak_langsung = $res->belanja_tidak_langsung;
+ } else {
+ $total_anggaran += 0;
+ $total_belanja += 0;
+ $belanja_pegawai += 0;
+ $belanja_barang_jasa += 0;
+ $belanja_modal += 0;
+ $belanja_tidak_langsung += 0;
+ }
+ }
+
+ $data_pendidikan['sum'] = [
+ 'total_belanja' => (float) ($total_belanja),
+ 'total_belanja_persen' => (float) (($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100),
+ 'selisih_anggaran_realisasi' => (float) (0),
+ 'selisih_anggaran_realisasi_persen' => (float) (0),
+ 'belanja_pegawai' => (float) ($belanja_pegawai),
+ 'belanja_pegawai_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100),
+ 'belanja_barang_jasa' => (float) ($belanja_barang_jasa),
+ 'belanja_barang_jasa_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100),
+ 'belanja_modal' => (float) ($belanja_modal),
+ 'belanja_modal_persen' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100),
+ 'belanja_tidak_langsung' => (float) ($belanja_tidak_langsung),
+ 'belanja_tidak_langsung_persen' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100),
+ ];
+ $data_pendidikan['chart'] = [
+ [
+ 'anggaran' => 'Belanja Pegawai',
+ 'value' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Barang dan Jasa',
+ 'value' => (float) (($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Modal',
+ 'value' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Tidak Langsung',
+ 'value' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100),
+ ],
+ ];
+ } else {
+ $total_anggaran = 0;
+ $total_belanja = 0;
+ $belanja_pegawai = 0;
+ $belanja_barang_jasa = 0;
+ $belanja_modal = 0;
+ $belanja_tidak_langsung = 0;
+
+ $query_result = DB::table('das_anggaran_realisasi')
+ ->selectRaw('sum(total_anggaran) as total_anggaran, sum(total_belanja) as total_belanja,
+ sum(belanja_pegawai) as belanja_pegawai, sum(belanja_barang_jasa) as belanja_barang_jasa,
+ sum(belanja_modal) as belanja_modal, sum(belanja_tidak_langsung) as belanja_tidak_langsung')
+ ->where('profil_id', '=', $this->profil->id);
+
+ if ($mid != 'Semua') {
+ $query_result->where('bulan', '=', $mid);
+ }
+ $query_result->where('tahun', '=', $year);
+
+ $res = $query_result->first();
+
+ if (! empty($res)) {
+ $total_anggaran = $res->total_anggaran;
+ $total_belanja = $res->total_belanja;
+ $belanja_pegawai = $res->belanja_pegawai;
+ $belanja_barang_jasa = $res->belanja_barang_jasa;
+ $belanja_modal = $res->belanja_modal;
+ $belanja_tidak_langsung = $res->belanja_tidak_langsung;
+ }
+
+ $data_pendidikan['sum'] = [
+ 'total_belanja' => (float) ($total_belanja),
+ 'total_belanja_persen' => (float) (($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100),
+ 'selisih_anggaran_realisasi' => (float) (0),
+ 'selisih_anggaran_realisasi_persen' => (float) (0),
+ 'belanja_pegawai' => (float) ($belanja_pegawai),
+ 'belanja_pegawai_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100),
+ 'belanja_barang_jasa' => (float) ($belanja_barang_jasa),
+ 'belanja_barang_jasa_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100),
+ 'belanja_modal' => (float) ($belanja_modal),
+ 'belanja_modal_persen' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100),
+ 'belanja_tidak_langsung' => (float) ($belanja_tidak_langsung),
+ 'belanja_tidak_langsung_persen' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100),
+ ];
+ $data_pendidikan['chart'] = [
+ [
+ 'anggaran' => 'Belanja Pegawai',
+ 'value' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Barang dan Jasa',
+ 'value' => (float) (($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Modal',
+ 'value' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100),
+ ],
+ [
+ 'anggaran' => 'Belanja Tidak Langsung',
+ 'value' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100),
+ ],
+ ];
+ }
+
+ return $data_pendidikan;
+ }
+}
diff --git a/app/Http/Controllers/Page/DownloadController.php b/app/Http/Controllers/FrontEnd/DownloadController.php
similarity index 73%
rename from app/Http/Controllers/Page/DownloadController.php
rename to app/Http/Controllers/FrontEnd/DownloadController.php
index 9922a4ccc..8981cf8c7 100644
--- a/app/Http/Controllers/Page/DownloadController.php
+++ b/app/Http/Controllers/FrontEnd/DownloadController.php
@@ -29,24 +29,26 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\Prosedur;
use App\Models\Regulasi;
-use Illuminate\Support\Facades\DB;
+use App\Models\FormDokumen;
use Yajra\DataTables\DataTables;
+use Illuminate\Support\Facades\DB;
+use App\Http\Controllers\Controller;
-class DownloadController extends Controller
+class DownloadController extends FrontEndController
{
public function indexProsedur()
{
Counter::count('unduhan.prosedur');
- $page_title = 'Prosedur';
+ $page_title = 'Prosedur';
$page_description = 'Daftar SOP Kecamatan';
- $prosedurs = Prosedur::all();
+ $prosedurs = Prosedur::all();
return view('pages.unduhan.prosedur', compact(['page_title', 'page_description', 'prosedurs']));
}
@@ -66,8 +68,8 @@ public function getDataProsedur()
public function showProsedur($nama_prosedur)
{
- $prosedur = Prosedur::where('slug', $nama_prosedur)->first();
- $page_title = 'Detail Prosedur :' . $prosedur->judul_prosedur;
+ $prosedur = Prosedur::where('slug', $nama_prosedur)->first();
+ $page_title = 'Detail Prosedur :'.$prosedur->judul_prosedur;
return view('pages.unduhan.prosedur_show', compact('page_title', 'prosedur'));
}
@@ -75,6 +77,7 @@ public function showProsedur($nama_prosedur)
public function downloadProsedur($file)
{
$getFile = Prosedur::where('judul_prosedur', str_replace('-', ' ', $file))->firstOrFail();
+
return response()->download($getFile->file_prosedur);
}
@@ -83,17 +86,17 @@ public function indexRegulasi()
Counter::count('unduhan.regulasi');
// TODO: Gunakan datatables
- $page_title = 'Regulasi';
+ $page_title = 'Regulasi';
$page_description = 'Daftar regulasi Kecamatan';
- $regulasi = Regulasi::orderBy('id', 'asc')->paginate(10);
+ $regulasi = Regulasi::orderBy('id', 'asc')->paginate(10);
return view('pages.unduhan.regulasi', compact('page_title', 'page_description', 'regulasi'));
}
public function showRegulasi($nama_regulasi)
{
- $regulasi = Regulasi::where('judul', str_replace('-', ' ', $nama_regulasi))->first();
- $page_title = 'Detail Regulasi :' . $regulasi->judul;
+ $regulasi = Regulasi::where('judul', str_replace('-', ' ', $nama_regulasi))->first();
+ $page_title = 'Detail Regulasi :'.$regulasi->judul;
return view('pages.unduhan.regulasi_show', compact('page_title', 'regulasi'));
}
@@ -101,6 +104,7 @@ public function showRegulasi($nama_regulasi)
public function downloadRegulasi($file)
{
$getFile = Regulasi::where('judul', str_replace('-', ' ', $file))->firstOrFail();
+
return response()->download($getFile->file_regulasi);
}
@@ -108,7 +112,7 @@ public function indexFormDokumen()
{
Counter::count('unduhan.form-dokumen');
- $page_title = 'Dokumen';
+ $page_title = 'Dokumen';
$page_description = 'Daftar Formulir Dokumen';
return view('pages.unduhan.form-dokumen', compact('page_title', 'page_description'));
@@ -116,25 +120,17 @@ public function indexFormDokumen()
public function getDataDokumen()
{
- $query = DB::table('das_form_dokumen')->selectRaw('id, nama_dokumen, file_dokumen');
- return DataTables::of($query->get())
+ return DataTables::of(FormDokumen::query())
->addColumn('aksi', function ($row) {
- $data['download_url'] = asset($row->file_dokumen);
+ $data['show_url'] = asset($row->file_dokumen);
+ $data['download_url'] = route('unduhan.form-dokumen.download', $row->id);
return view('forms.aksi', $data);
})->make();
}
- public function showDokumen($nama_dokumen)
- {
- $dokumen = dokumen::where('judul', str_replace('-', ' ', $nama_regulasi))->first();
- $page_title = 'Detail Dokumen :' . $dokumen->judul;
- return view('pages.unduhan.dokumen_show', compact('page_title', 'dokumen'));
- }
-
- public function downloadDokumen($file)
+ public function downloadDokumen(FormDokumen $file)
{
- $getFile = Dokumen::where('judul', str_replace('-', ' ', $file))->firstOrFail();
- return response()->download($getFile->file_dokumen);
+ return response()->download($file->file_dokumen);
}
}
diff --git a/app/Http/Controllers/Page/KependudukanController.php b/app/Http/Controllers/FrontEnd/KependudukanController.php
similarity index 82%
rename from app/Http/Controllers/Page/KependudukanController.php
rename to app/Http/Controllers/FrontEnd/KependudukanController.php
index f559efe1b..7288814de 100644
--- a/app/Http/Controllers/Page/KependudukanController.php
+++ b/app/Http/Controllers/FrontEnd/KependudukanController.php
@@ -29,19 +29,20 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\DataDesa;
use App\Models\Penduduk;
use App\Models\Profil;
use Illuminate\Support\Facades\DB;
use Yajra\DataTables\DataTables;
-class KependudukanController extends Controller
+class KependudukanController extends FrontEndController
{
protected $profil;
+
protected $penduduk;
public function __construct(Profil $profil, Penduduk $penduduk)
@@ -50,6 +51,7 @@ public function __construct(Profil $profil, Penduduk $penduduk)
$this->penduduk = $penduduk;
parent::__construct();
}
+
/**
* Menampilkan Data Kependudukan
**/
@@ -57,10 +59,10 @@ public function showKependudukan()
{
Counter::count('statistik.kependudukan');
- $data['page_title'] = 'Kependudukan';
+ $data['page_title'] = 'Kependudukan';
$data['page_description'] = 'Statistik Kependudukan';
- $data['year_list'] = $this->years_list();
- $data['list_desa'] = DataDesa::all();
+ $data['year_list'] = $this->years_list();
+ $data['list_desa'] = DataDesa::all();
$data = array_merge($data, $this->createDashboardKependudukan('Semua', date('Y')));
@@ -77,14 +79,15 @@ protected function years_list($max_tahun = null)
for ($y = $min_tahun; $y <= ($max_tahun ?? date('Y')); $y++) {
$daftar_tahun[] = $y;
}
+
return $daftar_tahun;
}
public function showKependudukanPartial()
{
- $data['page_title'] = 'Kependudukan';
+ $data['page_title'] = 'Kependudukan';
$data['page_description'] = 'Statistik Kependudukan';
- $data['year_list'] = $this->years_list();
+ $data['year_list'] = $this->years_list();
if (request('did') && request('y')) {
$data = array_merge($data, $this->createDashboardKependudukan(request('did'), request('y')));
@@ -100,11 +103,11 @@ protected function createDashboardKependudukan($did, $year)
// Get Total Penduduk Aktif
$query_total_penduduk_aktif = $this->penduduk->getPendudukAktif($did, $year);
- $total_penduduk = (clone $query_total_penduduk_aktif)->count();
+ $total_penduduk = (clone $query_total_penduduk_aktif)->count();
$data['total_penduduk'] = $total_penduduk;
// Get Total Laki-Laki
- $total_laki_laki = (clone $query_total_penduduk_aktif)
+ $total_laki_laki = (clone $query_total_penduduk_aktif)
->where('sex', 1)
->count();
@@ -125,15 +128,15 @@ protected function createDashboardKependudukan($did, $year)
$data['total_disabilitas'] = $total_disabilitas;
if ($total_penduduk == 0) {
- $data['ktp_wajib'] = 0;
- $data['ktp_terpenuhi'] = 0;
+ $data['ktp_wajib'] = 0;
+ $data['ktp_terpenuhi'] = 0;
$data['ktp_persen_terpenuhi'] = 0;
- $data['akta_terpenuhi'] = 0;
+ $data['akta_terpenuhi'] = 0;
$data['akta_persen_terpenuhi'] = 0;
- $data['aktanikah_wajib'] = 0;
- $data['aktanikah_terpenuhi'] = 0;
+ $data['aktanikah_wajib'] = 0;
+ $data['aktanikah_terpenuhi'] = 0;
$data['aktanikah_persen_terpenuhi'] = 0;
} else {
// Get Data KTP Penduduk Terpenuhi
@@ -148,8 +151,8 @@ protected function createDashboardKependudukan($did, $year)
$ktp_persen_terpenuhi = ($ktp_terpenuhi / $ktp_wajib) * 100;
- $data['ktp_wajib'] = $ktp_wajib;
- $data['ktp_terpenuhi'] = $ktp_terpenuhi;
+ $data['ktp_wajib'] = $ktp_wajib;
+ $data['ktp_terpenuhi'] = $ktp_terpenuhi;
$data['ktp_persen_terpenuhi'] = format_number_id($ktp_persen_terpenuhi);
// Get Data Akta Penduduk Terpenuhi
@@ -159,8 +162,8 @@ protected function createDashboardKependudukan($did, $year)
->where('akta_lahir', '<>', '-')
->count();
- $akta_persen_terpenuhi = ($akta_terpenuhi / $total_penduduk) * 100;
- $data['akta_terpenuhi'] = $akta_terpenuhi;
+ $akta_persen_terpenuhi = ($akta_terpenuhi / $total_penduduk) * 100;
+ $data['akta_terpenuhi'] = $akta_terpenuhi;
$data['akta_persen_terpenuhi'] = format_number_id($akta_persen_terpenuhi);
// Get Data Akta Nikah Penduduk Terpenuhi
@@ -174,13 +177,13 @@ protected function createDashboardKependudukan($did, $year)
->where('akta_perkawinan', '<>', '-')
->count();
- $data['aktanikah_wajib'] = 0;
- $data['aktanikah_terpenuhi'] = 0;
+ $data['aktanikah_wajib'] = 0;
+ $data['aktanikah_terpenuhi'] = 0;
$data['aktanikah_persen_terpenuhi'] = format_number_id(0);
if ($aktanikah_wajib != 0) {
- $aktanikah_persen_terpenuhi = ($aktanikah_terpenuhi / $aktanikah_wajib) * 100;
- $data['aktanikah_wajib'] = $aktanikah_wajib;
- $data['aktanikah_terpenuhi'] = $aktanikah_terpenuhi;
+ $aktanikah_persen_terpenuhi = ($aktanikah_terpenuhi / $aktanikah_wajib) * 100;
+ $data['aktanikah_wajib'] = $aktanikah_wajib;
+ $data['aktanikah_terpenuhi'] = $aktanikah_terpenuhi;
$data['aktanikah_persen_terpenuhi'] = format_number_id($aktanikah_persen_terpenuhi);
}
}
@@ -190,7 +193,7 @@ protected function createDashboardKependudukan($did, $year)
public function getChartPenduduk()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Grafik Pertumbuhan
@@ -202,25 +205,26 @@ public function getChartPenduduk()
$data[] = ['year' => $yearls, 'value_lk' => $query_result_laki, 'value_pr' => $query_result_perempuan];
}
+
return $data;
}
public function getChartPendudukUsia()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Grafik Kategori Usia
$categories = DB::table('ref_umur')->orderBy('ref_umur.dari')->where('status', '=', 1)->get();
- $colors = [7 => '#09a8ff', 6 => '#09bcff', 5 => '#09d1ff', 4 => '#09e5ff', 3 => '#09faff', 2 => '#09fff0', 1 => '#09ffdc'];
- $data = [];
+ $colors = [7 => '#09a8ff', 6 => '#09bcff', 5 => '#09d1ff', 4 => '#09e5ff', 3 => '#09faff', 2 => '#09fff0', 1 => '#09ffdc'];
+ $data = [];
foreach ($categories as $umur) {
$query_total = $this->penduduk->getPendudukAktif($did, $year)
->whereRaw('DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(das_penduduk.tanggal_lahir)), \'%Y\')+0 >= ? ', $umur->dari)
->whereRaw('DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(tanggal_lahir)), \'%Y\')+0 <= ?', $umur->sampai);
- $total = $query_total->count();
- $data[] = ['umur' => ucfirst(strtolower($umur->nama)) . ' (' . $umur->dari . ' - ' . $umur->sampai . ' tahun)', 'value' => $total, 'color' => $colors[$umur->id]];
+ $total = $query_total->count();
+ $data[] = ['umur' => ucfirst(strtolower($umur->nama)).' ('.$umur->dari.' - '.$umur->sampai.' tahun)', 'value' => $total, 'color' => $colors[$umur->id]];
}
return $data;
@@ -228,7 +232,7 @@ public function getChartPendudukUsia()
public function getChartPendudukPendidikan()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Grafik Data Pendidikan
@@ -261,26 +265,26 @@ public function getChartPendudukPendidikan()
->count();
$data_pendidikan[] = [
- 'year' => $year,
- 'SD' => $total_sd,
- 'SLTP' => $total_sltp,
- 'SLTA' => $total_slta,
- 'DIPLOMA' => $total_diploma,
- 'SARJANA' => $total_sarjana,
- ];
+ 'year' => $year,
+ 'SD' => $total_sd,
+ 'SLTP' => $total_sltp,
+ 'SLTA' => $total_slta,
+ 'DIPLOMA' => $total_diploma,
+ 'SARJANA' => $total_sarjana,
+ ];
return $data_pendidikan;
}
public function getChartPendudukGolDarah()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Chart Penduduk By Golongan Darah
- $data = [];
+ $data = [];
$golongan_darah = DB::table('ref_golongan_darah')->orderBy('id')->get();
- $colors = [1 => '#f97d7d', 2 => '#f86565', 3 => '#f74d4d', 4 => '#f63434', 13 => '#f51c1c'];
+ $colors = [1 => '#f97d7d', 2 => '#f86565', 3 => '#f74d4d', 4 => '#f63434', 13 => '#f51c1c'];
foreach ($golongan_darah as $val) {
$query_total = DB::table('das_penduduk')
//->join('das_keluarga', 'das_penduduk.no_kk', '=', 'das_keluarga.no_kk')
@@ -296,7 +300,7 @@ public function getChartPendudukGolDarah()
if ($did != 'Semua') {
$query_total->where('das_penduduk.desa_id', '=', $did);
}
- $total = $query_total->count();
+ $total = $query_total->count();
$data[] = ['blod_type' => $val->nama, 'total' => $total, 'color' => $colors[$val->id]];
}
@@ -305,13 +309,13 @@ public function getChartPendudukGolDarah()
public function getChartPendudukKawin()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Chart Penduduk By Status Perkawinan
- $data = [];
+ $data = [];
$status_kawin = DB::table('ref_kawin')->orderBy('id')->get();
- $colors = [1 => '#d365f8', 2 => '#c534f6', 3 => '#b40aed', 4 => '#8f08bc'];
+ $colors = [1 => '#d365f8', 2 => '#c534f6', 3 => '#b40aed', 4 => '#8f08bc'];
foreach ($status_kawin as $val) {
$total = $this->penduduk->getPendudukAktif($did, $year)
->where('status_kawin', $val->id)
@@ -324,12 +328,12 @@ public function getChartPendudukKawin()
public function getChartPendudukAgama()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Chart Penduduk By Aama
- $data = [];
- $agama = DB::table('ref_agama')->orderBy('id')->get();
+ $data = [];
+ $agama = DB::table('ref_agama')->orderBy('id')->get();
$colors = [1 => '#dcaf1e', 2 => '#dc9f1e', 3 => '#dc8f1e', 4 => '#dc7f1e', 5 => '#dc6f1e', 6 => '#dc5f1e', 7 => '#dc4f1e'];
foreach ($agama as $val) {
$total = $this->penduduk->getPendudukAktif($did, $year)
@@ -344,18 +348,18 @@ public function getChartPendudukAgama()
public function getChartPendudukKelamin()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Data Chart Penduduk By Jenis Kelamin
- $data = [];
+ $data = [];
$kelamin = [
[
- 'id' => 1,
+ 'id' => 1,
'nama' => 'Laki-Laki',
],
[
- 'id' => 2,
+ 'id' => 2,
'nama' => 'Perempuan',
],
];
@@ -368,8 +372,8 @@ public function getChartPendudukKelamin()
if ($did != 'Semua') {
$query_total->where('das_penduduk.desa_id', '=', $did);
}
- $total = $query_total->count();
- $data[] = ['sex' => $val['nama'], 'total' => $total, 'color' => '#' . random_color()];
+ $total = $query_total->count();
+ $data[] = ['sex' => $val['nama'], 'total' => $total, 'color' => '#'.random_color()];
}
return $data;
@@ -378,7 +382,7 @@ public function getChartPendudukKelamin()
public function getDataPenduduk()
{
$type = request('t');
- $did = request('did');
+ $did = request('did');
$year = request('year');
$query = DB::table('das_penduduk')
diff --git a/app/Http/Controllers/Page/KesehatanController.php b/app/Http/Controllers/FrontEnd/KesehatanController.php
similarity index 84%
rename from app/Http/Controllers/Page/KesehatanController.php
rename to app/Http/Controllers/FrontEnd/KesehatanController.php
index e23f6bd1f..00cdf1ea0 100644
--- a/app/Http/Controllers/Page/KesehatanController.php
+++ b/app/Http/Controllers/FrontEnd/KesehatanController.php
@@ -29,14 +29,14 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\DataDesa;
use Illuminate\Support\Facades\DB;
-class KesehatanController extends Controller
+class KesehatanController extends FrontEndController
{
public $nama_kuartal = ['q1' => 'Kuartal 1', 'q2' => 'Kuartal 2', 'q3' => 'Kuartal 3', 'q4' => 'Kuartal 4'];
@@ -45,17 +45,18 @@ public function showKesehatan()
{
Counter::count('statistik.kesehatan');
- $page_title = 'Kesehatan';
+ $page_title = 'Kesehatan';
$page_description = 'Data Kesehatan';
- $year_list = years_list();
- $list_desa = DataDesa::all();
+ $year_list = years_list();
+ $list_desa = DataDesa::all();
+
return view('pages.kesehatan.show_kesehatan', compact('page_title', 'page_description', 'year_list', 'list_desa'));
}
// Get Data Chart AKI & AKB
public function getChartAKIAKB()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
$data = [];
@@ -74,8 +75,8 @@ public function getChartAKIAKB()
$data_kesehatan[] = [
'year' => $yearl,
- 'aki' => $aki,
- 'akb' => $akb,
+ 'aki' => $aki,
+ 'akb' => $akb,
];
}
} else {
@@ -83,15 +84,15 @@ public function getChartAKIAKB()
// Quartal
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_akib')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
if ($did != 'Semua') {
$query->where('desa_id', '=', $did);
}
$data_tabel[] = [
'year' => $this->nama_kuartal[$key],
- 'aki' => $query->sum('aki'),
- 'akb' => $query->sum('akb'),
+ 'aki' => $query->sum('aki'),
+ 'akb' => $query->sum('akb'),
];
}
@@ -107,7 +108,7 @@ public function getChartAKIAKB()
// Quartal
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_akib')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
$data_tabel['quartal'][$key] = [
'aki' => $query->sum('aki'),
@@ -117,22 +118,22 @@ public function getChartAKIAKB()
// Detail Desa
foreach (kuartal_bulan() as $key => $kuartal) {
- $query = DB::table('das_akib')
+ $query = DB::table('das_akib')
->join('das_data_desa', 'das_akib.desa_id', '=', 'das_data_desa.desa_id')
->selectRaw('das_data_desa.nama, sum(das_akib.aki) as aki, sum(das_akib.akb) as akb')
- ->whereRaw('das_akib.bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('das_akib.bulan in ('.$this->getIdsQuartal($key).')')
->where('das_akib.tahun', $year)
->groupBy('das_data_desa.nama')->get();
$data_tabel['desa'][$key] = $query;
}
$tabel_kesehatan = view('pages.kesehatan.tabel_akiakb_1', compact('data_tabel'))->render();
- //$tabel_kesehatan = $data_tabel;
+ //$tabel_kesehatan = $data_tabel;
} elseif ($year != 'Semua' && $did != 'Semua') {
$data_tabel = [];
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_akib')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year)
->where('desa_id', $did);
$data_tabel['quartal'][$key] = [
@@ -146,14 +147,14 @@ public function getChartAKIAKB()
return [
'grafik' => $data_kesehatan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
// Get Data Chart Cakupan Imunisasi
public function getChartImunisasi()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
$data = [];
@@ -169,20 +170,20 @@ public function getChartImunisasi()
}
$data_kesehatan[] = [
- 'year' => $yearl,
+ 'year' => $yearl,
'cakupan_imunisasi' => $query->sum('cakupan_imunisasi'),
];
}
} else {
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_imunisasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
if ($did != 'Semua') {
$query->where('desa_id', '=', $did);
}
$data_tabel[] = [
- 'year' => $this->nama_kuartal[$key],
+ 'year' => $this->nama_kuartal[$key],
'cakupan_imunisasi' => $query->sum('cakupan_imunisasi'),
];
}
@@ -199,7 +200,7 @@ public function getChartImunisasi()
// Quartal
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_imunisasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
$data_tabel['quartal'][$key] = [
'cakupan_imunisasi' => $query->sum('cakupan_imunisasi'),
@@ -208,22 +209,22 @@ public function getChartImunisasi()
// Detail Desa
foreach (kuartal_bulan() as $key => $kuartal) {
- $query = DB::table('das_imunisasi')
+ $query = DB::table('das_imunisasi')
->join('das_data_desa', 'das_imunisasi.desa_id', '=', 'das_data_desa.desa_id')
->selectRaw('das_data_desa.nama, sum(das_imunisasi.cakupan_imunisasi) as cakupan_imunisasi')
- ->whereRaw('das_imunisasi.bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('das_imunisasi.bulan in ('.$this->getIdsQuartal($key).')')
->where('das_imunisasi.tahun', $year)
->groupBy('das_data_desa.nama')->get();
$data_tabel['desa'][$key] = $query;
}
$tabel_kesehatan = view('pages.kesehatan.tabel_imunisasi_1', compact('data_tabel'))->render();
- //$tabel_kesehatan = $data_tabel;
+ //$tabel_kesehatan = $data_tabel;
} elseif ($year != 'Semua' && $did != 'Semua') {
$data_tabel = [];
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_imunisasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year)
->where('desa_id', $did);
$data_tabel['quartal'][$key] = [
@@ -237,14 +238,14 @@ public function getChartImunisasi()
return [
'grafik' => $data_kesehatan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
// Get Chart Epidemi Penyakit
public function getChartEpidemiPenyakit()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
$data = [];
@@ -260,7 +261,7 @@ public function getChartEpidemiPenyakit()
}
$data_kesehatan[] = [
- 'year' => $yearl,
+ 'year' => $yearl,
'jumlah' => $query->sum('jumlah_penderita'),
];
}
@@ -269,12 +270,12 @@ public function getChartEpidemiPenyakit()
foreach (semester() as $key => $val) {
$penyakit = DB::table('ref_penyakit')->get();
- $temp = [];
+ $temp = [];
foreach ($penyakit as $value) {
$query_total = DB::table('das_epidemi_penyakit')
//->join('ref_penyakit', 'das_epidemi_penyakit.penyakit_id', '=', 'ref_penyakit.id')
->where('das_epidemi_penyakit.kecamatan_id', '=', $pid)
- ->whereRaw('das_epidemi_penyakit.bulan in (' . $this->getIdsSemester($key) . ')')
+ ->whereRaw('das_epidemi_penyakit.bulan in ('.$this->getIdsSemester($key).')')
->where('das_epidemi_penyakit.tahun', $year)
->where('das_epidemi_penyakit.penyakit_id', $value->id);
@@ -282,9 +283,9 @@ public function getChartEpidemiPenyakit()
$query_total->where('das_epidemi_penyakit.desa_id', '=', $did);
}
$total = $query_total->sum('das_epidemi_penyakit.jumlah_penderita');
- $temp = array_add($temp, 'penyakit' . $value->id, $total);
+ $temp = array_add($temp, 'penyakit'.$value->id, $total);
}
- $datas[] = array_add($temp, 'year', 'Semester ' . $key);
+ $datas[] = array_add($temp, 'year', 'Semester '.$key);
}
$data_kesehatan = $datas;
@@ -341,14 +342,14 @@ public function getChartEpidemiPenyakit()
}*/
return [
'grafik' => $data_kesehatan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
// Get Chart Toilet & Sanitasi
public function getChartToiletSanitasi()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
$data = [];
@@ -363,8 +364,8 @@ public function getChartToiletSanitasi()
}
$data_kesehatan[] = [
- 'year' => $yearl,
- 'toilet' => $query->sum('toilet'),
+ 'year' => $yearl,
+ 'toilet' => $query->sum('toilet'),
'sanitasi' => $query->sum('sanitasi'),
];
}
@@ -373,14 +374,14 @@ public function getChartToiletSanitasi()
// Quartal
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_toilet_sanitasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
if ($did != 'Semua') {
$query->where('desa_id', '=', $did);
}
$data_tabel[] = [
- 'year' => $this->nama_kuartal[$key],
- 'toilet' => $query->sum('toilet'),
+ 'year' => $this->nama_kuartal[$key],
+ 'toilet' => $query->sum('toilet'),
'sanitasi' => $query->sum('sanitasi'),
];
}
@@ -397,10 +398,10 @@ public function getChartToiletSanitasi()
// Quartal
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_toilet_sanitasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year);
$data_tabel['quartal'][$key] = [
- 'toilet' => $query->sum('toilet'),
+ 'toilet' => $query->sum('toilet'),
'sanitasi' => $query->sum('sanitasi'),
];
}
@@ -410,23 +411,23 @@ public function getChartToiletSanitasi()
$query = DB::table('das_toilet_sanitasi')
->join('das_data_desa', 'das_toilet_sanitasi.desa_id', '=', 'das_data_desa.desa_id')
->selectRaw('das_data_desa.nama, sum(das_toilet_sanitasi.toilet) as toilet, sum(das_toilet_sanitasi.sanitasi) as sanitasi')
- ->whereRaw('das_toilet_sanitasi.bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('das_toilet_sanitasi.bulan in ('.$this->getIdsQuartal($key).')')
->where('das_toilet_sanitasi.tahun', $year)
->groupBy('das_data_desa.nama')->get();
$data_tabel['desa'][$key] = $query;
}
$tabel_kesehatan = view('pages.kesehatan.tabel_sanitasi_1', compact('data_tabel'))->render();
- //$tabel_kesehatan = $data_tabel;
+ //$tabel_kesehatan = $data_tabel;
} elseif ($year != 'Semua' && $did != 'Semua') {
$data_tabel = [];
foreach (kuartal_bulan() as $key => $kuartal) {
$query = DB::table('das_toilet_sanitasi')
- ->whereRaw('bulan in (' . $this->getIdsQuartal($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsQuartal($key).')')
->where('tahun', $year)
->where('desa_id', $did);
$data_tabel['quartal'][$key] = [
- 'toilet' => $query->sum('toilet'),
+ 'toilet' => $query->sum('toilet'),
'sanitasi' => $query->sum('sanitasi'),
];
}
@@ -436,27 +437,29 @@ public function getChartToiletSanitasi()
return [
'grafik' => $data_kesehatan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
private function getIdsQuartal($q)
{
$quartal = kuartal_bulan()[$q];
- $ids = '';
+ $ids = '';
foreach ($quartal as $key => $val) {
- $ids .= $key . ',';
+ $ids .= $key.',';
}
+
return rtrim($ids, ',');
}
public function getIdsSemester($sm)
{
$semester = semester()[$sm];
- $ids = '';
+ $ids = '';
foreach ($semester as $key => $val) {
- $ids .= $key . ',';
+ $ids .= $key.',';
}
+
return rtrim($ids, ',');
}
}
diff --git a/app/Http/Controllers/Page/PageController.php b/app/Http/Controllers/FrontEnd/PageController.php
similarity index 67%
rename from app/Http/Controllers/Page/PageController.php
rename to app/Http/Controllers/FrontEnd/PageController.php
index 46813f2aa..7ff16fa3b 100644
--- a/app/Http/Controllers/Page/PageController.php
+++ b/app/Http/Controllers/FrontEnd/PageController.php
@@ -29,10 +29,10 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\Artikel;
use App\Models\DataDesa;
use App\Models\Event;
@@ -40,7 +40,7 @@
use Illuminate\Support\Facades\DB;
use willvincent\Feeds\Facades\FeedsFacade;
-class PageController extends Controller
+class PageController extends FrontEndController
{
protected $data = [];
@@ -49,9 +49,9 @@ public function index()
Counter::count('beranda');
return view('pages.index', [
- 'page_title' => 'Beranda',
- 'cari' => null,
- 'artikel' => Artikel::latest()->status()->paginate(config('setting.artikel_kecamatan_perhalaman') ?? 10),
+ 'page_title' => 'Beranda',
+ 'cari' => null,
+ 'artikel' => Artikel::latest()->status()->paginate(config('setting.artikel_kecamatan_perhalaman') ?? 10),
]);
}
@@ -59,20 +59,14 @@ public function beritaDesa()
{
$this->data = $this->getFeeds();
- // dd(
- // $this->data,
- // collect($this->data)->sortByDesc('date')->take(30)
- // );
-
$feeds = collect($this->data)->sortByDesc('date')->take(config('setting.jumlah_artikel_desa') ?? 30)->paginate(config('setting.artikel_desa_perhalaman') ?? 10);
- // $feeds->all();
return view('pages.berita.desa', [
- 'page_title' => 'Berita Desa',
- 'cari' => null,
- 'cari_desa' => null,
- 'list_desa' => DataDesa::orderBy('desa_id')->get(),
- 'feeds' => $feeds,
+ 'page_title' => 'Berita Desa',
+ 'cari' => null,
+ 'cari_desa' => null,
+ 'list_desa' => DataDesa::orderBy('desa_id')->get(),
+ 'feeds' => $feeds,
]);
}
@@ -88,17 +82,17 @@ private function getFeeds()
$getFeeds = FeedsFacade::make($desa['website'], 5, true);
foreach ($getFeeds->get_items() as $item) {
$feeds[] = [
- 'desa_id' => $desa['desa_id'],
- 'nama_desa' => $desa['nama'],
- 'feed_link' => $item->get_feed()->get_permalink(),
- 'feed_title' => $item->get_feed()->get_title(),
- 'link' => $item->get_link(),
- 'date' => \Carbon\Carbon::parse($item->get_date('U')),
- 'author' => $item->get_author()->get_name() ?? 'Administrator',
- 'title' => $item->get_title(),
- 'image' => get_tag_image($item->get_description()),
- 'description' => strip_tags(substr(str_replace(['&', 'nbsp;', '[...]'], '', $item->get_description()), 0, 250) . '[...]'),
- 'content' => $item->get_content(),
+ 'desa_id' => $desa['desa_id'],
+ 'nama_desa' => $desa['nama'],
+ 'feed_link' => $item->get_feed()->get_permalink(),
+ 'feed_title' => $item->get_feed()->get_title(),
+ 'link' => $item->get_link(),
+ 'date' => \Carbon\Carbon::parse($item->get_date('U')),
+ 'author' => $item->get_author()->get_name() ?? 'Administrator',
+ 'title' => $item->get_title(),
+ 'image' => get_tag_image($item->get_description()),
+ 'description' => strip_tags(substr(str_replace(['&', 'nbsp;', '[...]'], '', $item->get_description()), 0, 250).'[...]'),
+ 'content' => $item->get_content(),
];
}
}
@@ -123,7 +117,7 @@ public function filterFeeds(Request $request)
$req = $request->cari;
if ($req != '') {
$feeds = $feeds->filter(function ($value, $key) use ($req) {
- return (stripos($value['title'], $req) || stripos($value['description'], $req));
+ return stripos($value['title'], $req) || stripos($value['description'], $req);
});
}
@@ -137,11 +131,11 @@ public function filterFeeds(Request $request)
$feeds->all();
- $html = view('pages.berita.feeds', [
- 'page_title' => 'Beranda',
- 'cari_desa' => null,
- 'list_desa' => DataDesa::orderBy('desa_id')->get(),
- 'feeds' => $feeds,
+ $html = view('pages.berita.feeds', [
+ 'page_title' => 'Beranda',
+ 'cari_desa' => null,
+ 'list_desa' => DataDesa::orderBy('desa_id')->get(),
+ 'feeds' => $feeds,
])->render();
return response()->json(compact('html'));
@@ -149,8 +143,8 @@ public function filterFeeds(Request $request)
public function PotensiByKategory($slug)
{
- $kategoriPotensi = DB::table('das_tipe_potensi')->where('slug', $slug)->first();
- $page_title = 'Potensi';
+ $kategoriPotensi = DB::table('das_tipe_potensi')->where('slug', $slug)->first();
+ $page_title = 'Potensi';
$page_description = 'Potensi-Potensi';
$potensis = DB::table('das_potensi')->where('kategori_id', $kategoriPotensi->id)->simplePaginate(10);
@@ -160,10 +154,10 @@ public function PotensiByKategory($slug)
public function PotensiShow($kategori, $slug)
{
- $kategoriPotensi = DB::table('das_tipe_potensi')->where('slug', $slug)->first();
- $page_title = 'Potensi';
+ $kategoriPotensi = DB::table('das_tipe_potensi')->where('slug', $slug)->first();
+ $page_title = 'Potensi';
$page_description = 'Potensi-Potensi Kecamatan';
- $potensi = DB::table('das_potensi')->where('nama_potensi', str_replace('-', ' ', $slug))->first();
+ $potensi = DB::table('das_potensi')->where('nama_potensi', str_replace('-', ' ', $slug))->first();
return view('pages.potensi.show', compact(['page_title', 'page_description', 'potensi', 'kategoriPotensi']));
}
@@ -172,8 +166,8 @@ public function DesaShow($slug)
{
// Counter::count('desa.show');
- $desa = DataDesa::nama($slug)->firstOrFail();
- $page_title = 'Desa ' . $desa->nama;
+ $desa = DataDesa::nama($slug)->firstOrFail();
+ $page_title = 'Desa '.$desa->nama;
$page_description = 'Data Desa';
return view('pages.desa.desa_show', compact('page_title', 'page_description', 'desa'));
@@ -187,8 +181,8 @@ public function refresh_captcha()
public function detailBerita($slug)
{
$artikel = Artikel::where('slug', $slug)->status()->firstOrFail();
- $page_title = $artikel->judul;
- $page_description = substr($artikel->isi, 0, 300) . ' ...';
+ $page_title = $artikel->judul;
+ $page_description = substr($artikel->isi, 0, 300).' ...';
$page_image = $artikel->gambar;
return view('pages.berita.detail', compact('page_title', 'page_description', 'page_image', 'artikel'));
@@ -196,8 +190,8 @@ public function detailBerita($slug)
public function eventDetail($slug)
{
- $event = Event::slug($slug)->firstOrFail();
- $page_title = $event->event_name;
+ $event = Event::slug($slug)->firstOrFail();
+ $page_title = $event->event_name;
$page_description = $event->description;
return view('pages.event.event_detail', compact('page_title', 'page_description', 'event'));
diff --git a/app/Http/Controllers/Page/PendidikanController.php b/app/Http/Controllers/FrontEnd/PendidikanController.php
similarity index 60%
rename from app/Http/Controllers/Page/PendidikanController.php
rename to app/Http/Controllers/FrontEnd/PendidikanController.php
index 88c31dc6d..f5df7969f 100644
--- a/app/Http/Controllers/Page/PendidikanController.php
+++ b/app/Http/Controllers/FrontEnd/PendidikanController.php
@@ -29,16 +29,17 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\DataDesa;
use Illuminate\Support\Facades\DB;
-class PendidikanController extends Controller
+class PendidikanController extends FrontEndController
{
public $nama_kuartal = ['q1' => 'Kuartal 1', 'q2' => 'Kuartal 2', 'q3' => 'Kuartal 3', 'q4' => 'Kuartal 4'];
+
/**
* Menampilkan Data Pendidikan
**/
@@ -46,17 +47,17 @@ public function showPendidikan()
{
Counter::count('statistik.pendidikan');
- $data['page_title'] = 'Pendidikan';
- $data['page_description'] = 'Data Pendidikan ' . $this->sebutan_wilayah;
- $data['year_list'] = years_list();
- $data['list_desa'] = DataDesa::all();
+ $data['page_title'] = 'Pendidikan';
+ $data['page_description'] = 'Data Pendidikan '.$this->sebutan_wilayah;
+ $data['year_list'] = years_list();
+ $data['list_desa'] = DataDesa::all();
return view('pages.pendidikan.show_pendidikan')->with($data);
}
public function getChartTingkatPendidikan()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Grafik Data TIngkat Pendidikan
@@ -68,15 +69,15 @@ public function getChartTingkatPendidikan()
->where('tahun', '=', $yearl);
$data_pendidikan[] = [
- 'year' => $yearl,
- 'tidak_tamat_sekolah' => $query_pendidikan->sum('tidak_tamat_sekolah'),
- 'tamat_sd' => $query_pendidikan->sum('tamat_sd'),
- 'tamat_smp' => $query_pendidikan->sum('tamat_smp'),
- 'tamat_sma' => $query_pendidikan->sum('tamat_sma'),
+ 'year' => $yearl,
+ 'tidak_tamat_sekolah' => $query_pendidikan->sum('tidak_tamat_sekolah'),
+ 'tamat_sd' => $query_pendidikan->sum('tamat_sd'),
+ 'tamat_smp' => $query_pendidikan->sum('tamat_smp'),
+ 'tamat_sma' => $query_pendidikan->sum('tamat_sma'),
'tamat_diploma_sederajat' => $query_pendidikan->sum('tamat_diploma_sederajat'),
];
}
- } elseif ($year != "Semua" && $did == "Semua") {
+ } elseif ($year != 'Semua' && $did == 'Semua') {
$data_tabel = [];
// Quartal
$desa = DataDesa::all();
@@ -89,11 +90,11 @@ public function getChartTingkatPendidikan()
->get()->first();
$data_tabel[] = [
- 'year' => $value->nama,
- 'tidak_tamat_sekolah' => intval($query_pendidikan->tidak_tamat_sekolah),
- 'tamat_sd' => intval($query_pendidikan->tamat_sd),
- 'tamat_smp' => intval($query_pendidikan->tamat_smp),
- 'tamat_sma' => intval($query_pendidikan->tamat_sma),
+ 'year' => $value->nama,
+ 'tidak_tamat_sekolah' => intval($query_pendidikan->tidak_tamat_sekolah),
+ 'tamat_sd' => intval($query_pendidikan->tamat_sd),
+ 'tamat_smp' => intval($query_pendidikan->tamat_smp),
+ 'tamat_sma' => intval($query_pendidikan->tamat_sma),
'tamat_diploma_sederajat' => intval($query_pendidikan->tamat_diploma_sederajat),
];
}
@@ -105,18 +106,18 @@ public function getChartTingkatPendidikan()
foreach (semester() as $key => $value) {
$query_pendidikan = DB::table('das_tingkat_pendidikan')
->selectRaw('sum(tidak_tamat_sekolah) as tidak_tamat_sekolah, sum(tamat_sd) as tamat_sd, sum(tamat_smp) as tamat_smp, sum(tamat_sma) as tamat_sma, sum(tamat_diploma_sederajat) as tamat_diploma_sederajat')
- ->whereRaw('bulan in (' . $this->getIdsSemester($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsSemester($key).')')
->where('tahun', $year)
->where('desa_id', '=', $did)
->get()->first();
//return $query_pendidikan;
$data_tabel[] = [
- 'year' => 'Semester ' . $key,
- 'tidak_tamat_sekolah' => intval($query_pendidikan->tidak_tamat_sekolah),
- 'tamat_sd' => intval($query_pendidikan->tamat_sd),
- 'tamat_smp' => intval($query_pendidikan->tamat_smp),
- 'tamat_sma' => intval($query_pendidikan->tamat_sma),
+ 'year' => 'Semester '.$key,
+ 'tidak_tamat_sekolah' => intval($query_pendidikan->tidak_tamat_sekolah),
+ 'tamat_sd' => intval($query_pendidikan->tamat_sd),
+ 'tamat_smp' => intval($query_pendidikan->tamat_smp),
+ 'tamat_sma' => intval($query_pendidikan->tamat_sma),
'tamat_diploma_sederajat' => intval($query_pendidikan->tamat_diploma_sederajat),
];
}
@@ -130,11 +131,11 @@ public function getChartTingkatPendidikan()
->where('desa_id', $did);
$data_pendidikan[] = [
- 'year' => $yearl,
- 'tidak_tamat_sekolah' => $query_pendidikan->sum('tidak_tamat_sekolah'),
- 'tamat_sd' => $query_pendidikan->sum('tamat_sd'),
- 'tamat_smp' => $query_pendidikan->sum('tamat_smp'),
- 'tamat_sma' => $query_pendidikan->sum('tamat_sma'),
+ 'year' => $yearl,
+ 'tidak_tamat_sekolah' => $query_pendidikan->sum('tidak_tamat_sekolah'),
+ 'tamat_sd' => $query_pendidikan->sum('tamat_sd'),
+ 'tamat_smp' => $query_pendidikan->sum('tamat_smp'),
+ 'tamat_sma' => $query_pendidikan->sum('tamat_sma'),
'tamat_diploma_sederajat' => $query_pendidikan->sum('tamat_diploma_sederajat'),
];
}
@@ -145,13 +146,13 @@ public function getChartTingkatPendidikan()
return [
'grafik' => $data_pendidikan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
public function getChartPutusSekolah()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Grafik Data Siswa PAUD
@@ -163,15 +164,15 @@ public function getChartPutusSekolah()
->where('tahun', '=', $yearl);
$data_pendidikan[] = [
- 'year' => $yearl,
- 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
+ 'year' => $yearl,
+ 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
'anak_usia_paud' => $query_pendidikan->sum('anak_usia_paud'),
- 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
- 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
- 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
- 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
- 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
- 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
+ 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
+ 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
+ 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
+ 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
+ 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
+ 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
];
}
} elseif ($year == 'Semua' && $did != 'Semua') {
@@ -182,15 +183,15 @@ public function getChartPutusSekolah()
->where('desa_id', $did);
$data_pendidikan[] = [
- 'year' => $yearl,
- 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
+ 'year' => $yearl,
+ 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
'anak_usia_paud' => $query_pendidikan->sum('anak_usia_paud'),
- 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
- 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
- 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
- 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
- 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
- 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
+ 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
+ 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
+ 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
+ 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
+ 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
+ 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
];
}
} elseif ($year != 'Semua' && $did == 'Semua') {
@@ -202,15 +203,15 @@ public function getChartPutusSekolah()
->where('desa_id', $value->desa_id);
$data_pendidikan[] = [
- 'year' => $value->nama,
- 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
+ 'year' => $value->nama,
+ 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
'anak_usia_paud' => $query_pendidikan->sum('anak_usia_paud'),
- 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
- 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
- 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
- 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
- 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
- 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
+ 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
+ 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
+ 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
+ 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
+ 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
+ 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
];
}
} elseif ($year != 'Semua' && $did != 'Semua') {
@@ -218,20 +219,20 @@ public function getChartPutusSekolah()
// Quartal
foreach (semester() as $key => $kuartal) {
$query_pendidikan = DB::table('das_putus_sekolah')
- ->whereRaw('bulan in (' . $this->getIdsSemester($key) . ')')
+ ->whereRaw('bulan in ('.$this->getIdsSemester($key).')')
->where('tahun', $year)
->where('desa_id', '=', $did);
$data_tabel[] = [
- 'year' => 'Semester ' . $key,
- 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
+ 'year' => 'Semester '.$key,
+ 'siswa_paud' => $query_pendidikan->sum('siswa_paud'),
'anak_usia_paud' => $query_pendidikan->sum('anak_usia_paud'),
- 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
- 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
- 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
- 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
- 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
- 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
+ 'siswa_sd' => $query_pendidikan->sum('siswa_sd'),
+ 'anak_usia_sd' => $query_pendidikan->sum('anak_usia_sd'),
+ 'siswa_smp' => $query_pendidikan->sum('siswa_smp'),
+ 'anak_usia_smp' => $query_pendidikan->sum('anak_usia_smp'),
+ 'siswa_sma' => $query_pendidikan->sum('siswa_sma'),
+ 'anak_usia_sma' => $query_pendidikan->sum('anak_usia_sma'),
];
}
@@ -240,15 +241,16 @@ public function getChartPutusSekolah()
// Data Tabel AKI & AKB
$tabel_kesehatan = [];
+
return [
'grafik' => $data_pendidikan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
public function getChartFasilitasPAUD()
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
// Grafik Data Fasilitas PAUD
@@ -263,9 +265,9 @@ public function getChartFasilitasPAUD()
}
$data_pendidikan[] = [
- 'year' => $yearl,
- 'jumlah_paud' => $query_pendidikan->sum('jumlah_paud'),
- 'jumlah_guru_paud' => $query_pendidikan->sum('jumlah_guru_paud'),
+ 'year' => $yearl,
+ 'jumlah_paud' => $query_pendidikan->sum('jumlah_paud'),
+ 'jumlah_guru_paud' => $query_pendidikan->sum('jumlah_guru_paud'),
'jumlah_siswa_paud' => $query_pendidikan->sum('jumlah_siswa_paud'),
];
}
@@ -274,15 +276,15 @@ public function getChartFasilitasPAUD()
// Quartal
foreach (semester() as $key => $kuartal) {
$query_pendidikan = DB::table('das_fasilitas_paud')
- ->whereRaw('semester in (' . $this->getIdsSemester($key) . ')')
+ ->whereRaw('semester in ('.$this->getIdsSemester($key).')')
->where('tahun', $year);
if ($did != 'Semua') {
$query_pendidikan->where('desa_id', '=', $did);
}
$data_tabel[] = [
- 'year' => 'Semester ' . $key,
- 'jumlah_paud' => $query_pendidikan->sum('jumlah_paud'),
- 'jumlah_guru_paud' => $query_pendidikan->sum('jumlah_guru_paud'),
+ 'year' => 'Semester '.$key,
+ 'jumlah_paud' => $query_pendidikan->sum('jumlah_paud'),
+ 'jumlah_guru_paud' => $query_pendidikan->sum('jumlah_guru_paud'),
'jumlah_siswa_paud' => $query_pendidikan->sum('jumlah_siswa_paud'),
];
}
@@ -295,27 +297,29 @@ public function getChartFasilitasPAUD()
return [
'grafik' => $data_pendidikan,
- 'tabel' => $tabel_kesehatan,
+ 'tabel' => $tabel_kesehatan,
];
}
private function getIdsQuartal($q)
{
$quartal = kuartal_bulan()[$q];
- $ids = '';
+ $ids = '';
foreach ($quartal as $key => $val) {
- $ids .= $key . ',';
+ $ids .= $key.',';
}
+
return rtrim($ids, ',');
}
private function getIdsSemester($smt)
{
$semester = semester()[$smt];
- $ids = '';
+ $ids = '';
foreach ($semester as $key => $val) {
- $ids .= $key . ',';
+ $ids .= $key.',';
}
+
return rtrim($ids, ',');
}
}
diff --git a/app/Http/Controllers/Page/ProfilController.php b/app/Http/Controllers/FrontEnd/ProfilController.php
similarity index 76%
rename from app/Http/Controllers/Page/ProfilController.php
rename to app/Http/Controllers/FrontEnd/ProfilController.php
index 7cf7cc592..9d9ce252e 100644
--- a/app/Http/Controllers/Page/ProfilController.php
+++ b/app/Http/Controllers/FrontEnd/ProfilController.php
@@ -29,23 +29,36 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\DataDesa;
use App\Models\DataUmum;
use App\Models\Pengurus;
use App\Models\Profil;
use Illuminate\Support\Facades\DB;
-class ProfilController extends Controller
+class ProfilController extends FrontEndController
{
+ public function tipologi()
+ {
+ Counter::count('profil.tipologi');
+
+ $profil = Profil::with(['dataUmum'])->first();
+ $page_title = 'Tipologi';
+ if (isset($profil)) {
+ $page_description = $this->browser_title;
+ }
+
+ return view('pages.profil.tipologi', compact('page_title', 'page_description', 'profil'));
+ }
+
public function sejarah()
{
Counter::count('profil.sejarah');
- $profil = Profil::with(['dataUmum'])->first();
+ $profil = Profil::with(['dataUmum'])->first();
$page_title = 'Sejarah';
if (isset($profil)) {
$page_description = $this->browser_title;
@@ -61,9 +74,9 @@ public function LetakGeografis()
{
Counter::count('profil.letak-geografis');
- $profil = Profil::with(['dataDesa'])->first();
- $wilayah_desa = DataDesa::whereNotNull('path')->get();
- $data_umum = DataUmum::first();
+ $profil = Profil::with(['dataDesa'])->first();
+ $wilayah_desa = DataDesa::whereNotNull('path')->get();
+ $data_umum = DataUmum::first();
$page_title = 'Letak Geografis';
if (isset($profil)) {
$page_description = $this->browser_title;
@@ -76,8 +89,8 @@ public function StrukturPemerintahan()
{
Counter::count('profil.struktur-pemerintahan');
- $profil = $this->profil;
- $pengurus = Pengurus::status()->get()->sortBy('jabatan.jenis');
+ $profil = $this->profil;
+ $pengurus = Pengurus::status()->get()->sortBy('jabatan.jenis');
$page_title = 'Struktur Pemerintahan';
if (isset($profil)) {
$page_description = $this->browser_title;
@@ -90,7 +103,7 @@ public function VisiMisi()
{
Counter::count('profil.visi-misi');
- $profil = $this->profil;
+ $profil = $this->profil;
$page_title = 'Visi dan Misi';
if (isset($profil)) {
$page_description = $this->browser_title;
@@ -103,10 +116,10 @@ public function Kependudukan()
{
Counter::count('profil.kependudukan');
- $data['page_title'] = 'Kependudukan';
+ $data['page_title'] = 'Kependudukan';
$data['page_description'] = 'Statistik Kependudukan';
- $data['year_list'] = years_list();
- $data['list_desa'] = DataDesa::all();
+ $data['year_list'] = years_list();
+ $data['list_desa'] = DataDesa::all();
$data = array_merge($data, $this->createDashboardKependudukan('Semua', date('Y')));
@@ -115,8 +128,8 @@ public function Kependudukan()
public function showProfile()
{
- $profil = $this->profil;
- $dokumen = DB::table('das_form_dokumen')->take(5)->get();
+ $profil = $this->profil;
+ $dokumen = DB::table('das_form_dokumen')->take(5)->get();
$page_title = 'Profil';
if (isset($profil)) {
diff --git a/app/Http/Controllers/Page/ProgramBantuanController.php b/app/Http/Controllers/FrontEnd/ProgramBantuanController.php
similarity index 90%
rename from app/Http/Controllers/Page/ProgramBantuanController.php
rename to app/Http/Controllers/FrontEnd/ProgramBantuanController.php
index 0c1644898..2feb56302 100644
--- a/app/Http/Controllers/Page/ProgramBantuanController.php
+++ b/app/Http/Controllers/FrontEnd/ProgramBantuanController.php
@@ -29,15 +29,15 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
use App\Facades\Counter;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\DataDesa;
use App\Models\Program;
use Illuminate\Support\Facades\DB;
-class ProgramBantuanController extends Controller
+class ProgramBantuanController extends FrontEndController
{
/**
* Menampilkan Data Program Bantuan
@@ -46,10 +46,10 @@ public function showProgramBantuan()
{
Counter::count('statistik.program-bantuan');
- $page_title = 'Program Bantuan';
+ $page_title = 'Program Bantuan';
$page_description = 'Data Program Bantuan';
- $year_list = years_list();
- $list_desa = DataDesa::all();
+ $year_list = years_list();
+ $list_desa = DataDesa::all();
return view('pages.program_bantuan.show_program_bantuan', compact('page_title', 'page_description', 'year_list', 'list_desa'));
}
@@ -67,9 +67,9 @@ public function getChartBantuanKeluarga()
// TODO : Gunakan relasi antar tabel.
private function get_data(int $sasaran = 1)
{
- $did = request('did');
+ $did = request('did');
$year = request('y');
- $data = [];
+ $data = [];
$program = Program::where('sasaran', $sasaran)->get();
foreach ($program as $prog) {
@@ -88,6 +88,7 @@ private function get_data(int $sasaran = 1)
$data[] = ['program' => $prog->nama, 'value' => $query_result->count()];
}
+
return $data;
}
}
diff --git a/app/Http/Controllers/Page/WebFaqController.php b/app/Http/Controllers/FrontEnd/WebFaqController.php
similarity index 92%
rename from app/Http/Controllers/Page/WebFaqController.php
rename to app/Http/Controllers/FrontEnd/WebFaqController.php
index c4bf0fa5c..c8f6db616 100644
--- a/app/Http/Controllers/Page/WebFaqController.php
+++ b/app/Http/Controllers/FrontEnd/WebFaqController.php
@@ -29,12 +29,12 @@
* @link https://github.com/OpenSID/opendk
*/
-namespace App\Http\Controllers\Page;
+namespace App\Http\Controllers\FrontEnd;
-use App\Http\Controllers\Controller;
+use App\Http\Controllers\FrontEndController;
use App\Models\Faq;
-class WebFaqController extends Controller
+class WebFaqController extends FrontEndController
{
public function index()
{
diff --git a/resources/lang/pl/installer_messages.php b/app/Http/Controllers/FrontEndController.php
similarity index 52%
rename from resources/lang/pl/installer_messages.php
rename to app/Http/Controllers/FrontEndController.php
index 76773c5dc..63f2aa14a 100644
--- a/resources/lang/pl/installer_messages.php
+++ b/app/Http/Controllers/FrontEndController.php
@@ -29,64 +29,13 @@
* @link https://github.com/OpenSID/opendk
*/
-return [
-
- /**
- *
- * Shared translations.
- *
- */
- 'title' => 'Laravel Instalator',
- 'next' => 'Następny krok',
-
- /**
- *
- * Home page translations.
- *
- */
- 'welcome' => [
- 'title' => 'Instalacja Laravel',
- 'message' => 'Witaj w kreatorze instalacji.',
- ],
-
- /**
- *
- * Requirements page translations.
- *
- */
- 'requirements' => [
- 'title' => 'Wymagania systemowe ',
- ],
-
- /**
- *
- * Permissions page translations.
- *
- */
- 'permissions' => [
- 'title' => 'Uprawnienia',
- ],
-
- /**
- *
- * Environment page translations.
- *
- */
- 'environment' => [
- 'title' => 'Ustawnienia środowiska',
- 'save' => 'Zapisz .env',
- 'success' => 'Plik .env został poprawnie zainstalowany.',
- 'errors' => 'Nie można zapisać pliku .env, Proszę utworzyć go ręcznie.',
- ],
-
- /**
- *
- * Final page translations.
- *
- */
- 'final' => [
- 'title' => 'Instalacja zakończona',
- 'finished' => 'Aplikacja została poprawnie zainstalowana.',
- 'exit' => 'Kliknij aby zakończyć',
- ],
-];
+namespace App\Http\Controllers;
+
+class FrontEndController extends Controller
+{
+ public function __construct()
+ {
+ parent::__construct();
+ theme_active();
+ }
+}
diff --git a/app/Http/Controllers/Helpers/Parsedown.php b/app/Http/Controllers/Helpers/Parsedown.php
index 3774c4eb3..0fe20b140 100644
--- a/app/Http/Controllers/Helpers/Parsedown.php
+++ b/app/Http/Controllers/Helpers/Parsedown.php
@@ -34,9 +34,13 @@
class Parsedown
{
protected $breaksEnabled;
+
protected $markupEscaped;
+
protected $urlsLinked = true;
+
protected $safeMode;
+
protected $safeLinksWhitelist = [
'http://',
'https://',
@@ -95,24 +99,25 @@ class Parsedown
//
protected $InlineTypes = [
- '"' => ['SpecialCharacter'],
- '!' => ['Image'],
- '&' => ['SpecialCharacter'],
- '*' => ['Emphasis'],
- ':' => ['Url'],
- '<' => ['UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'],
- '>' => ['SpecialCharacter'],
- '[' => ['Link'],
- '_' => ['Emphasis'],
- '`' => ['Code'],
- '~' => ['Strikethrough'],
+ '"' => ['SpecialCharacter'],
+ '!' => ['Image'],
+ '&' => ['SpecialCharacter'],
+ '*' => ['Emphasis'],
+ ':' => ['Url'],
+ '<' => ['UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'],
+ '>' => ['SpecialCharacter'],
+ '[' => ['Link'],
+ '_' => ['Emphasis'],
+ '`' => ['Code'],
+ '~' => ['Strikethrough'],
'\\' => ['EscapeSequence'],
];
// ~
protected $inlineMarkerList = '!"*_&[:<>`~\\';
- private static $instances = [];
+
+ private static $instances = [];
//
// Fields
@@ -126,18 +131,23 @@ class Parsedown
protected $specialCharacters = [
'\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|',
];
+
protected $StrongRegex = [
'*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s',
'_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us',
];
+
protected $EmRegex = [
'*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',
'_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us',
];
+
protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?';
- protected $voidElements = [
+
+ protected $voidElements = [
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source',
];
+
protected $textLevelElements = [
'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont',
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
@@ -252,7 +262,7 @@ protected function lines(array $lines)
// ~
if (isset($CurrentBlock['continuable'])) {
- $Block = $this->{'block' . $CurrentBlock['type'] . 'Continue'}($Line, $CurrentBlock);
+ $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock);
if (isset($Block)) {
$CurrentBlock = $Block;
@@ -260,7 +270,7 @@ protected function lines(array $lines)
continue;
}
if ($this->isBlockCompletable($CurrentBlock['type'])) {
- $CurrentBlock = $this->{'block' . $CurrentBlock['type'] . 'Complete'}($CurrentBlock);
+ $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
}
@@ -282,12 +292,12 @@ protected function lines(array $lines)
// ~
foreach ($blockTypes as $blockType) {
- $Block = $this->{'block' . $blockType}($Line, $CurrentBlock);
+ $Block = $this->{'block'.$blockType}($Line, $CurrentBlock);
if (isset($Block)) {
$Block['type'] = $blockType;
- if (!isset($Block['identified'])) {
+ if (! isset($Block['identified'])) {
$Blocks[] = $CurrentBlock;
$Block['identified'] = true;
@@ -305,8 +315,8 @@ protected function lines(array $lines)
// ~
- if (isset($CurrentBlock) && !isset($CurrentBlock['type']) && !isset($CurrentBlock['interrupted'])) {
- $CurrentBlock['element']['text'] .= "\n" . $text;
+ if (isset($CurrentBlock) && ! isset($CurrentBlock['type']) && ! isset($CurrentBlock['interrupted'])) {
+ $CurrentBlock['element']['text'] .= "\n".$text;
} else {
$Blocks[] = $CurrentBlock;
@@ -319,7 +329,7 @@ protected function lines(array $lines)
// ~
if (isset($CurrentBlock['continuable']) && $this->isBlockCompletable($CurrentBlock['type'])) {
- $CurrentBlock = $this->{'block' . $CurrentBlock['type'] . 'Complete'}($CurrentBlock);
+ $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
// ~
@@ -350,12 +360,12 @@ protected function lines(array $lines)
protected function isBlockContinuable($Type)
{
- return method_exists($this, 'block' . $Type . 'Continue');
+ return method_exists($this, 'block'.$Type.'Continue');
}
protected function isBlockCompletable($Type)
{
- return method_exists($this, 'block' . $Type . 'Complete');
+ return method_exists($this, 'block'.$Type.'Complete');
}
//
@@ -363,7 +373,7 @@ protected function isBlockCompletable($Type)
protected function blockCode($Line, $Block = null)
{
- if (isset($Block) && !isset($Block['type']) && !isset($Block['interrupted'])) {
+ if (isset($Block) && ! isset($Block['type']) && ! isset($Block['interrupted'])) {
return;
}
@@ -372,9 +382,9 @@ protected function blockCode($Line, $Block = null)
return [
'element' => [
- 'name' => 'pre',
+ 'name' => 'pre',
'handler' => 'element',
- 'text' => [
+ 'text' => [
'name' => 'code',
'text' => $text,
],
@@ -439,7 +449,7 @@ protected function blockCommentContinue($Line, array $Block)
return;
}
- $Block['markup'] .= "\n" . $Line['body'];
+ $Block['markup'] .= "\n".$Line['body'];
if (preg_match('/-->$/', $Line['text'])) {
$Block['closed'] = true;
@@ -453,7 +463,7 @@ protected function blockCommentContinue($Line, array $Block)
protected function blockFencedCode($Line)
{
- if (preg_match('/^[' . $Line['text'][0] . ']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) {
+ if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) {
$Element = [
'name' => 'code',
'text' => '',
@@ -474,7 +484,7 @@ protected function blockFencedCode($Line)
*/
$language = substr($matches[1], 0, strcspn($matches[1], " \t\n\f\r"));
- $class = 'language-' . $language;
+ $class = 'language-'.$language;
$Element['attributes'] = [
'class' => $class,
@@ -482,11 +492,11 @@ protected function blockFencedCode($Line)
}
return [
- 'char' => $Line['text'][0],
+ 'char' => $Line['text'][0],
'element' => [
- 'name' => 'pre',
+ 'name' => 'pre',
'handler' => 'element',
- 'text' => $Element,
+ 'text' => $Element,
],
];
}
@@ -504,7 +514,7 @@ protected function blockFencedCodeContinue($Line, $Block)
unset($Block['interrupted']);
}
- if (preg_match('/^' . $Block['char'] . '{3,}[ ]*$/', $Line['text'])) {
+ if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) {
$Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1);
$Block['complete'] = true;
@@ -512,7 +522,7 @@ protected function blockFencedCodeContinue($Line, $Block)
return $Block;
}
- $Block['element']['text']['text'] .= "\n" . $Line['body'];
+ $Block['element']['text']['text'] .= "\n".$Line['body'];
return $Block;
}
@@ -546,8 +556,8 @@ protected function blockHeader($Line)
return [
'element' => [
- 'name' => 'h' . min(6, $level),
- 'text' => $text,
+ 'name' => 'h'.min(6, $level),
+ 'text' => $text,
'handler' => 'line',
],
];
@@ -561,12 +571,12 @@ protected function blockList($Line)
{
[$name, $pattern] = $Line['text'][0] <= '-' ? ['ul', '[*+-]'] : ['ol', '[0-9]+[.]'];
- if (preg_match('/^(' . $pattern . '[ ]+)(.*)/', $Line['text'], $matches)) {
+ if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) {
$Block = [
- 'indent' => $Line['indent'],
+ 'indent' => $Line['indent'],
'pattern' => $pattern,
'element' => [
- 'name' => $name,
+ 'name' => $name,
'handler' => 'elements',
],
];
@@ -580,9 +590,9 @@ protected function blockList($Line)
}
$Block['li'] = [
- 'name' => 'li',
+ 'name' => 'li',
'handler' => 'li',
- 'text' => [
+ 'text' => [
$matches[2],
],
];
@@ -595,7 +605,7 @@ protected function blockList($Line)
protected function blockListContinue($Line, array $Block)
{
- if ($Block['indent'] === $Line['indent'] && preg_match('/^' . $Block['pattern'] . '(?:[ ]+(.*)|$)/', $Line['text'], $matches)) {
+ if ($Block['indent'] === $Line['indent'] && preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) {
if (isset($Block['interrupted'])) {
$Block['li']['text'][] = '';
@@ -609,9 +619,9 @@ protected function blockListContinue($Line, array $Block)
$text = $matches[1] ?? '';
$Block['li'] = [
- 'name' => 'li',
+ 'name' => 'li',
'handler' => 'li',
- 'text' => [
+ 'text' => [
$text,
],
];
@@ -625,7 +635,7 @@ protected function blockListContinue($Line, array $Block)
return $Block;
}
- if (!isset($Block['interrupted'])) {
+ if (! isset($Block['interrupted'])) {
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
$Block['li']['text'][] = $text;
@@ -667,9 +677,9 @@ protected function blockQuote($Line)
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) {
return [
'element' => [
- 'name' => 'blockquote',
+ 'name' => 'blockquote',
'handler' => 'lines',
- 'text' => (array) $matches[1],
+ 'text' => (array) $matches[1],
],
];
}
@@ -689,7 +699,7 @@ protected function blockQuoteContinue($Line, array $Block)
return $Block;
}
- if (!isset($Block['interrupted'])) {
+ if (! isset($Block['interrupted'])) {
$Block['element']['text'][] = $Line['text'];
return $Block;
@@ -701,7 +711,7 @@ protected function blockQuoteContinue($Line, array $Block)
protected function blockRule($Line)
{
- if (preg_match('/^([' . $Line['text'][0] . '])([ ]*\1){2,}[ ]*$/', $Line['text'])) {
+ if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) {
return [
'element' => [
'name' => 'hr',
@@ -715,7 +725,7 @@ protected function blockRule($Line)
protected function blockSetextHeader($Line, ?array $Block = null)
{
- if (!isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
+ if (! isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
return;
}
@@ -735,7 +745,7 @@ protected function blockMarkup($Line)
return;
}
- if (preg_match('/^<(\w[\w-]*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $Line['text'], $matches)) {
+ if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) {
$element = strtolower($matches[1]);
if (in_array($element, $this->textLevelElements)) {
@@ -743,8 +753,8 @@ protected function blockMarkup($Line)
}
$Block = [
- 'name' => $matches[1],
- 'depth' => 0,
+ 'name' => $matches[1],
+ 'depth' => 0,
'markup' => $Line['text'],
];
@@ -763,7 +773,7 @@ protected function blockMarkup($Line)
return;
}
- if (preg_match('/<\/' . $matches[1] . '>[ ]*$/i', $remainder)) {
+ if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) {
$Block['closed'] = true;
}
}
@@ -778,11 +788,11 @@ protected function blockMarkupContinue($Line, array $Block)
return;
}
- if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) { // open
+ if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { // open
$Block['depth']++;
}
- if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) { // close
+ if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { // close
if ($Block['depth'] > 0) {
$Block['depth']--;
} else {
@@ -796,7 +806,7 @@ protected function blockMarkupContinue($Line, array $Block)
unset($Block['interrupted']);
}
- $Block['markup'] .= "\n" . $Line['body'];
+ $Block['markup'] .= "\n".$Line['body'];
return $Block;
}
@@ -810,7 +820,7 @@ protected function blockReference($Line)
$id = strtolower($matches[1]);
$Data = [
- 'url' => $matches[2],
+ 'url' => $matches[2],
'title' => null,
];
@@ -831,7 +841,7 @@ protected function blockReference($Line)
protected function blockTable($Line, ?array $Block = null)
{
- if (!isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
+ if (! isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
return;
}
@@ -880,8 +890,8 @@ protected function blockTable($Line, ?array $Block = null)
$headerCell = trim($headerCell);
$HeaderElement = [
- 'name' => 'th',
- 'text' => $headerCell,
+ 'name' => 'th',
+ 'text' => $headerCell,
'handler' => 'line',
];
@@ -889,7 +899,7 @@ protected function blockTable($Line, ?array $Block = null)
$alignment = $alignments[$index];
$HeaderElement['attributes'] = [
- 'style' => 'text-align: ' . $alignment . ';',
+ 'style' => 'text-align: '.$alignment.';',
];
}
@@ -901,27 +911,27 @@ protected function blockTable($Line, ?array $Block = null)
$Block = [
'alignments' => $alignments,
'identified' => true,
- 'element' => [
- 'name' => 'table',
+ 'element' => [
+ 'name' => 'table',
'handler' => 'elements',
],
];
$Block['element']['text'][] = [
- 'name' => 'thead',
+ 'name' => 'thead',
'handler' => 'elements',
];
$Block['element']['text'][] = [
- 'name' => 'tbody',
+ 'name' => 'tbody',
'handler' => 'elements',
- 'text' => [],
+ 'text' => [],
];
$Block['element']['text'][0]['text'][] = [
- 'name' => 'tr',
+ 'name' => 'tr',
'handler' => 'elements',
- 'text' => $HeaderElements,
+ 'text' => $HeaderElements,
];
return $Block;
@@ -948,14 +958,14 @@ protected function blockTableContinue($Line, array $Block)
$cell = trim($cell);
$Element = [
- 'name' => 'td',
+ 'name' => 'td',
'handler' => 'line',
- 'text' => $cell,
+ 'text' => $cell,
];
if (isset($Block['alignments'][$index])) {
$Element['attributes'] = [
- 'style' => 'text-align: ' . $Block['alignments'][$index] . ';',
+ 'style' => 'text-align: '.$Block['alignments'][$index].';',
];
}
@@ -963,9 +973,9 @@ protected function blockTableContinue($Line, array $Block)
}
$Element = [
- 'name' => 'tr',
+ 'name' => 'tr',
'handler' => 'elements',
- 'text' => $Elements,
+ 'text' => $Elements,
];
$Block['element']['text'][1]['text'][] = $Element;
@@ -982,8 +992,8 @@ protected function paragraph($Line)
{
return [
'element' => [
- 'name' => 'p',
- 'text' => $Line['text'],
+ 'name' => 'p',
+ 'text' => $Line['text'],
'handler' => 'line',
],
];
@@ -1009,13 +1019,13 @@ public function line($text, $nonNestables = [])
foreach ($this->InlineTypes[$marker] as $inlineType) {
// check to see if the current inline type is nestable in the current context
- if (!empty($nonNestables) && in_array($inlineType, $nonNestables)) {
+ if (! empty($nonNestables) && in_array($inlineType, $nonNestables)) {
continue;
}
- $Inline = $this->{'inline' . $inlineType}($Excerpt);
+ $Inline = $this->{'inline'.$inlineType}($Excerpt);
- if (!isset($Inline)) {
+ if (! isset($Inline)) {
continue;
}
@@ -1027,7 +1037,7 @@ public function line($text, $nonNestables = [])
// sets a default inline position
- if (!isset($Inline['position'])) {
+ if (! isset($Inline['position'])) {
$Inline['position'] = $markerPosition;
}
@@ -1074,12 +1084,12 @@ protected function inlineCode($Excerpt)
{
$marker = $Excerpt['text'][0];
- if (preg_match('/^(' . $marker . '+)[ ]*(.+?)[ ]*(? strlen($matches[0]),
+ 'extent' => strlen($matches[0]),
'element' => [
'name' => 'code',
'text' => $text,
@@ -1093,15 +1103,15 @@ protected function inlineEmailTag($Excerpt)
if (strpos($Excerpt['text'], '>') !== false && preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches)) {
$url = $matches[1];
- if (!isset($matches[2])) {
- $url = 'mailto:' . $url;
+ if (! isset($matches[2])) {
+ $url = 'mailto:'.$url;
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => strlen($matches[0]),
'element' => [
- 'name' => 'a',
- 'text' => $matches[1],
+ 'name' => 'a',
+ 'text' => $matches[1],
'attributes' => [
'href' => $url,
],
@@ -1112,7 +1122,7 @@ protected function inlineEmailTag($Excerpt)
protected function inlineEmphasis($Excerpt)
{
- if (!isset($Excerpt['text'][1])) {
+ if (! isset($Excerpt['text'][1])) {
return;
}
@@ -1127,11 +1137,11 @@ protected function inlineEmphasis($Excerpt)
}
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => strlen($matches[0]),
'element' => [
- 'name' => $emphasis,
+ 'name' => $emphasis,
'handler' => 'line',
- 'text' => $matches[1],
+ 'text' => $matches[1],
],
];
}
@@ -1148,7 +1158,7 @@ protected function inlineEscapeSequence($Excerpt)
protected function inlineImage($Excerpt)
{
- if (!isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') {
+ if (! isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') {
return;
}
@@ -1161,9 +1171,9 @@ protected function inlineImage($Excerpt)
}
$Inline = [
- 'extent' => $Link['extent'] + 1,
+ 'extent' => $Link['extent'] + 1,
'element' => [
- 'name' => 'img',
+ 'name' => 'img',
'attributes' => [
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['text'],
@@ -1181,12 +1191,12 @@ protected function inlineImage($Excerpt)
protected function inlineLink($Excerpt)
{
$Element = [
- 'name' => 'a',
- 'handler' => 'line',
+ 'name' => 'a',
+ 'handler' => 'line',
'nonNestables' => ['Url', 'Link'],
- 'text' => null,
- 'attributes' => [
- 'href' => null,
+ 'text' => null,
+ 'attributes' => [
+ 'href' => null,
'title' => null,
],
];
@@ -1223,18 +1233,18 @@ protected function inlineLink($Excerpt)
$definition = strtolower($Element['text']);
}
- if (!isset($this->DefinitionData['Reference'][$definition])) {
+ if (! isset($this->DefinitionData['Reference'][$definition])) {
return;
}
$Definition = $this->DefinitionData['Reference'][$definition];
- $Element['attributes']['href'] = $Definition['url'];
+ $Element['attributes']['href'] = $Definition['url'];
$Element['attributes']['title'] = $Definition['title'];
}
return [
- 'extent' => $extent,
+ 'extent' => $extent,
'element' => $Element,
];
}
@@ -1259,7 +1269,7 @@ protected function inlineMarkup($Excerpt)
];
}
- if ($Excerpt['text'][1] !== ' ' && preg_match('/^<\w[\w-]*(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*\/?>/s', $Excerpt['text'], $matches)) {
+ if ($Excerpt['text'][1] !== ' ' && preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) {
return [
'markup' => $matches[0],
'extent' => strlen($matches[0]),
@@ -1269,7 +1279,7 @@ protected function inlineMarkup($Excerpt)
protected function inlineSpecialCharacter($Excerpt)
{
- if ($Excerpt['text'][0] === '&' && !preg_match('/^?\w+;/', $Excerpt['text'])) {
+ if ($Excerpt['text'][0] === '&' && ! preg_match('/^?\w+;/', $Excerpt['text'])) {
return [
'markup' => '&',
'extent' => 1,
@@ -1280,7 +1290,7 @@ protected function inlineSpecialCharacter($Excerpt)
if (isset($SpecialCharacter[$Excerpt['text'][0]])) {
return [
- 'markup' => '&' . $SpecialCharacter[$Excerpt['text'][0]] . ';',
+ 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';',
'extent' => 1,
];
}
@@ -1288,16 +1298,16 @@ protected function inlineSpecialCharacter($Excerpt)
protected function inlineStrikethrough($Excerpt)
{
- if (!isset($Excerpt['text'][1])) {
+ if (! isset($Excerpt['text'][1])) {
return;
}
if ($Excerpt['text'][1] === '~' && preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) {
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => strlen($matches[0]),
'element' => [
- 'name' => 'del',
- 'text' => $matches[1],
+ 'name' => 'del',
+ 'text' => $matches[1],
'handler' => 'line',
],
];
@@ -1306,7 +1316,7 @@ protected function inlineStrikethrough($Excerpt)
protected function inlineUrl($Excerpt)
{
- if ($this->urlsLinked !== true || !isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/') {
+ if ($this->urlsLinked !== true || ! isset($Excerpt['text'][2]) || $Excerpt['text'][2] !== '/') {
return;
}
@@ -1314,11 +1324,11 @@ protected function inlineUrl($Excerpt)
$url = $matches[0][0];
return [
- 'extent' => strlen($matches[0][0]),
+ 'extent' => strlen($matches[0][0]),
'position' => $matches[0][1],
- 'element' => [
- 'name' => 'a',
- 'text' => $url,
+ 'element' => [
+ 'name' => 'a',
+ 'text' => $url,
'attributes' => [
'href' => $url,
],
@@ -1333,10 +1343,10 @@ protected function inlineUrlTag($Excerpt)
$url = $matches[1];
return [
- 'extent' => strlen($matches[0]),
+ 'extent' => strlen($matches[0]),
'element' => [
- 'name' => 'a',
- 'text' => $url,
+ 'name' => 'a',
+ 'text' => $url,
'attributes' => [
'href' => $url,
],
@@ -1369,7 +1379,7 @@ protected function element(array $Element)
$Element = $this->sanitiseElement($Element);
}
- $markup = '<' . $Element['name'];
+ $markup = '<'.$Element['name'];
if (isset($Element['attributes'])) {
foreach ($Element['attributes'] as $name => $value) {
@@ -1377,7 +1387,7 @@ protected function element(array $Element)
continue;
}
- $markup .= ' ' . $name . '="' . self::escape($value) . '"';
+ $markup .= ' '.$name.'="'.self::escape($value).'"';
}
}
@@ -1389,27 +1399,27 @@ protected function element(array $Element)
// very strongly consider an alternative if you're writing an
// extension
elseif (isset($Element['rawHtml'])) {
- $text = $Element['rawHtml'];
+ $text = $Element['rawHtml'];
$allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
- $permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
+ $permitRawHtml = ! $this->safeMode || $allowRawHtmlInSafeMode;
}
if (isset($text)) {
$markup .= '>';
- if (!isset($Element['nonNestables'])) {
+ if (! isset($Element['nonNestables'])) {
$Element['nonNestables'] = [];
}
if (isset($Element['handler'])) {
$markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
- } elseif (!$permitRawHtml) {
+ } elseif (! $permitRawHtml) {
$markup .= self::escape($text, true);
} else {
$markup .= $text;
}
- $markup .= '' . $Element['name'] . '>';
+ $markup .= ''.$Element['name'].'>';
} else {
$markup .= ' />';
}
@@ -1422,7 +1432,7 @@ protected function elements(array $Elements)
$markup = '';
foreach ($Elements as $Element) {
- $markup .= "\n" . $this->element($Element);
+ $markup .= "\n".$this->element($Element);
}
$markup .= "\n";
@@ -1438,7 +1448,7 @@ protected function li($lines)
$trimmedMarkup = trim($markup);
- if (!in_array('', $lines) && substr($trimmedMarkup, 0, 3) === '
') { + if (! in_array('', $lines) && substr($trimmedMarkup, 0, 3) === '
') { $markup = $trimmedMarkup; $markup = substr($markup, 3); @@ -1461,9 +1471,9 @@ public function parse($text) protected function sanitiseElement(array $Element) { - static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; + static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; static $safeUrlNameToAtt = [ - 'a' => 'href', + 'a' => 'href', 'img' => 'src', ]; @@ -1471,10 +1481,10 @@ protected function sanitiseElement(array $Element) $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); } - if (!empty($Element['attributes'])) { + if (! empty($Element['attributes'])) { foreach ($Element['attributes'] as $att => $val) { // filter out badly parsed attribute - if (!preg_match($goodAttribute, $att)) { + if (! preg_match($goodAttribute, $att)) { unset($Element['attributes'][$att]); } // dump onevent attribute diff --git a/app/Http/Controllers/Informasi/ArtikelController.php b/app/Http/Controllers/Informasi/ArtikelController.php index 130c5be9f..602ed3508 100644 --- a/app/Http/Controllers/Informasi/ArtikelController.php +++ b/app/Http/Controllers/Informasi/ArtikelController.php @@ -42,7 +42,7 @@ class ArtikelController extends Controller { public function index() { - $page_title = 'Artikel'; + $page_title = 'Artikel'; $page_description = 'Daftar Artikel'; return view('informasi.artikel.index', compact('page_title', 'page_description')); @@ -56,8 +56,8 @@ public function getDataArtikel(Request $request) ->addColumn('aksi', function ($row) { $data['show_web'] = route('berita.detail', $row->slug); - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.artikel.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.artikel.edit', $row->id); $data['delete_url'] = route('informasi.artikel.destroy', $row->id); } @@ -80,7 +80,7 @@ public function getDataArtikel(Request $request) public function create() { - $page_title = 'Artikel'; + $page_title = 'Artikel'; $page_description = 'Tambah Artikel'; return view('informasi.artikel.create', compact('page_title', 'page_description')); @@ -94,12 +94,13 @@ public function store(ArtikelRequest $request) $file = $request->file('gambar'); $path = Storage::putFile('public/artikel', $file); - $input['gambar'] = substr($path, 15) ; + $input['gambar'] = substr($path, 15); } Artikel::create($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Simpan artikel gagal!'); } @@ -108,7 +109,7 @@ public function store(ArtikelRequest $request) public function edit(Artikel $artikel) { - $page_title = 'Artikel'; + $page_title = 'Artikel'; $page_description = 'Ubah Artikel'; return view('informasi.artikel.edit', compact('artikel', 'page_title', 'page_description')); @@ -123,14 +124,15 @@ public function update(ArtikelRequest $request, Artikel $artikel) $file = $request->file('gambar'); $path = Storage::putFile('public/artikel', $file); - Storage::delete('public/artikel/' . $artikel->getRawOriginal('gambar')); + Storage::delete('public/artikel/'.$artikel->getRawOriginal('gambar')); - $input['gambar'] = substr($path, 15) ; + $input['gambar'] = substr($path, 15); } $artikel->update($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Artikel gagal dihapus!'); } @@ -141,10 +143,11 @@ public function destroy(Artikel $artikel) { try { if ($artikel->delete()) { - Storage::delete('public/artikel/' . $artikel->getRawOriginal('gambar')); + Storage::delete('public/artikel/'.$artikel->getRawOriginal('gambar')); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.artikel.index')->with('error', 'Artikel gagal dihapus!'); } diff --git a/app/Http/Controllers/Informasi/EventController.php b/app/Http/Controllers/Informasi/EventController.php deleted file mode 100644 index 0c766dd65..000000000 --- a/app/Http/Controllers/Informasi/EventController.php +++ /dev/null @@ -1,126 +0,0 @@ -waktu); - - $input = $request->input(); - $input['start'] = date('Y-m-d H:i', strtotime($waktu[0])); - $input['end'] = date('Y-m-d H:i', strtotime($waktu[1])); - $input['status'] = 'OPEN'; - Event::create($input); - } catch (\Exception $e) { - report($e); - return back()->withInput()->with('error', 'Simpan Event gagal!'); - } - - return redirect()->route('informasi.event.index')->with('success', 'Event berhasil disimpan!'); - } - - public function edit(Event $event) - { - $page_title = 'Event'; - $page_description = 'Ubah Event'; - $event->waktu = $event->start . ' - ' . $event->end; - - return view('informasi.event.edit', compact('page_title', 'page_description', 'event')); - } - - public function update(EventRequest $request, Event $event) - { - try { - $waktu = explode("-", $request->waktu); - $input = $request->all(); - - if ($request->hasFile('attachment')) { - $lampiran = $request->file('attachment'); - $fileName = $lampiran->getClientOriginalName(); - $path = "event/" . $event->id . '/'; - File::deleteDirectory(base_path('public/' . $path)); //hapus directory sebelumnya - $lampiran->move(base_path('public/'.$path), $fileName); - $input['attachment'] = $path . $fileName; - } - $input['end'] = date('Y-m-d H:i', strtotime($waktu[1])); - $input['start'] = date('Y-m-d H:i', strtotime($waktu[0])); - - $event->update($input); - } catch (\Exception $e) { - report($e); - return back()->withInput()->with('error', 'Ubah Event gagal!'); - } - - return redirect()->route('informasi.event.index')->with('success', 'Ubah Event sukses!'); - } - - public function destroy(Event $event) - { - try { - if ($event->delete()) { - if ($event->file_dokumen != null && File::exists(base_path('public/' . $event->file_dokumen))) { - unlink(base_path('public/' . $event->file_dokumen)); - } - } - } catch (\Exception $e) { - report($e); - return redirect()->route('informasi.event.index')->with('error', 'Event gagal dihapus!'); - } - - return redirect()->route('informasi.event.index')->with('success', 'Event berhasil dihapus!'); - } -} diff --git a/app/Http/Controllers/Informasi/FaqController.php b/app/Http/Controllers/Informasi/FaqController.php index 3a801a901..2a03d1007 100644 --- a/app/Http/Controllers/Informasi/FaqController.php +++ b/app/Http/Controllers/Informasi/FaqController.php @@ -47,7 +47,7 @@ class FaqController extends Controller */ public function index() { - $page_title = 'FAQ'; + $page_title = 'FAQ'; $page_description = 'Daftar FAQ'; return view('informasi.faq.index', compact('page_title', 'page_description')); @@ -61,8 +61,8 @@ public function getDataFaq(Request $request) ->addColumn('aksi', function ($row) { $data['show_web'] = route('faq'); - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.faq.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.faq.edit', $row->id); $data['delete_url'] = route('informasi.faq.destroy', $row->id); } @@ -87,7 +87,7 @@ public function getDataFaq(Request $request) */ public function create() { - $page_title = 'FAQ'; + $page_title = 'FAQ'; $page_description = 'Tambah FAQ'; return view('informasi.faq.create', compact('page_title', 'page_description')); @@ -102,13 +102,14 @@ public function store(FaqRequest $request) { request()->validate([ 'question' => 'required', - 'answer' => 'required', + 'answer' => 'required', ]); try { Faq::create($request->all()); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'FAQ gagal ditambah!'); } @@ -118,13 +119,13 @@ public function store(FaqRequest $request) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * @return Response */ public function edit($id) { - $faq = Faq::findOrFail($id); - $page_title = 'FAQ'; + $faq = Faq::findOrFail($id); + $page_title = 'FAQ'; $page_description = 'Ubah FAQ'; return view('informasi.faq.edit', compact('page_title', 'page_description', 'faq')); @@ -133,16 +134,16 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * @return Response */ - public function update(FaqRequest $request, $id) { try { Faq::findOrFail($id)->update($request->all()); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'FAQ gagal diubah!'); } @@ -152,7 +153,7 @@ public function update(FaqRequest $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * @return Response */ public function destroy($id) @@ -161,6 +162,7 @@ public function destroy($id) Faq::findOrFail($id)->delete(); } catch (\Exception $e) { report($e); + return redirect()->route('informasi.faq.index')->with('error', 'FAQ gagal dihapus!'); } diff --git a/app/Http/Controllers/Informasi/FormDokumenController.php b/app/Http/Controllers/Informasi/FormDokumenController.php index 752373937..59bd14bd6 100644 --- a/app/Http/Controllers/Informasi/FormDokumenController.php +++ b/app/Http/Controllers/Informasi/FormDokumenController.php @@ -40,7 +40,7 @@ class FormDokumenController extends Controller { public function index() { - $page_title = 'Dokumen'; + $page_title = 'Dokumen'; $page_description = 'Daftar Dokumen'; return view('informasi.form_dokumen.index', compact('page_title', 'page_description')); @@ -50,8 +50,8 @@ public function getDataDokumen() { return DataTables::of(FormDokumen::all()) ->addColumn('aksi', function ($row) { - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.form-dokumen.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.form-dokumen.edit', $row->id); $data['delete_url'] = route('informasi.form-dokumen.destroy', $row->id); } @@ -63,7 +63,7 @@ public function getDataDokumen() public function create() { - $page_title = 'Dokumen'; + $page_title = 'Dokumen'; $page_description = 'Tambah Dokumen'; return view('informasi.form_dokumen.create', compact('page_title', 'page_description')); @@ -75,17 +75,18 @@ public function store(DokumenRequest $request) $input = $request->input(); if ($request->hasFile('file_dokumen')) { - $file = $request->file('file_dokumen'); + $file = $request->file('file_dokumen'); $fileName = $file->getClientOriginalName(); - $path = "storage/form_dokumen/"; + $path = 'storage/form_dokumen/'; $file->move($path, $fileName); - $input['file_dokumen'] = $path . $fileName; + $input['file_dokumen'] = $path.$fileName; } FormDokumen::create($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Dokumen gagal disimpan!'); } @@ -94,8 +95,8 @@ public function store(DokumenRequest $request) public function edit(FormDokumen $dokumen) { - $page_title = 'Dokumen'; - $page_description = 'Ubah Dokumen ' . $dokumen->nama_dokumen; + $page_title = 'Dokumen'; + $page_description = 'Ubah Dokumen '.$dokumen->nama_dokumen; return view('informasi.form_dokumen.edit', compact('page_title', 'page_description', 'dokumen')); } @@ -106,18 +107,19 @@ public function update(DokumenRequest $request, FormDokumen $dokumen) $input = $request->all(); if ($request->hasFile('file_dokumen')) { - $file = $request->file('file_dokumen'); + $file = $request->file('file_dokumen'); $fileName = $file->getClientOriginalName(); - $path = "storage/form_dokumen/"; + $path = 'storage/form_dokumen/'; $file->move($path, $fileName); - unlink(base_path('public/' . $dokumen->file_dokumen)); + unlink(base_path('public/'.$dokumen->file_dokumen)); - $input['file_dokumen'] = $path . $fileName; + $input['file_dokumen'] = $path.$fileName; } $dokumen->update($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Dokumen gagal diubah!'); } @@ -128,10 +130,11 @@ public function destroy(FormDokumen $dokumen) { try { if ($dokumen->delete()) { - unlink(base_path('public/' . $dokumen->file_dokumen)); + unlink(base_path('public/'.$dokumen->file_dokumen)); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.form-dokumen.index')->with('error', 'Dokumen gagal dihapus!'); } @@ -144,6 +147,7 @@ public function download(FormDokumen $dokumen) return response()->download($dokumen->file_dokumen); } catch (\Exception $e) { report($e); + return back()->with('error', 'Dokumen tidak ditemukan'); } } diff --git a/app/Http/Controllers/Informasi/InformasiController.php b/app/Http/Controllers/Informasi/InformasiController.php index 15a14fb37..d061dadd8 100644 --- a/app/Http/Controllers/Informasi/InformasiController.php +++ b/app/Http/Controllers/Informasi/InformasiController.php @@ -38,10 +38,9 @@ class InformasiController extends Controller /** * Menampilkan Daftar Prosedur **/ - public function showProsedur() { - $data['page_title'] = 'Daftar Prosedur '; + $data['page_title'] = 'Daftar Prosedur '; $data['page_description'] = 'Daftar Prosedur '; return view('Informasi.prosedur')->with($data); @@ -50,10 +49,9 @@ public function showProsedur() /** * Menampilkan Data Potensi **/ - public function showPotensi() { - $data['page_title'] = 'Potensi Kecamatan'; + $data['page_title'] = 'Potensi Kecamatan'; $data['page_description'] = 'Menampilkan Data Potensi Kecamatan'; return view('informasi.potensi')->with($data); @@ -62,10 +60,9 @@ public function showPotensi() /** * Menampilkan Data Event **/ - public function showEvent() { - $data['page_title'] = 'Event'; + $data['page_title'] = 'Event'; $data['page_description'] = 'Menampilkan Event Terdekat'; return view('Informasi.event')->with($data); @@ -74,7 +71,6 @@ public function showEvent() /** * Menampilkan Data FAQ **/ - public function showFAQ() { $data['page_title'] = 'FAQ'; @@ -86,7 +82,6 @@ public function showFAQ() /** * Menampilkan Kontak Kecamatan **/ - public function showKontak() { $data['page_title'] = 'Kontak Kecamatan '; @@ -98,7 +93,6 @@ public function showKontak() /** * Menampilkan Kalender Kecamatan **/ - public function showKalender() { $data['page_title'] = 'Kalender Kecamatan '; diff --git a/app/Http/Controllers/Informasi/MediaSosialController.php b/app/Http/Controllers/Informasi/MediaSosialController.php index 8cf3b0be1..30af4b0fb 100644 --- a/app/Http/Controllers/Informasi/MediaSosialController.php +++ b/app/Http/Controllers/Informasi/MediaSosialController.php @@ -57,8 +57,8 @@ public function getDataMediaSosial(Request $request) ->addColumn('aksi', function ($row) { $data['show_web'] = $row->url; - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.media-sosial.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.media-sosial.edit', $row->id); $data['delete_url'] = route('informasi.media-sosial.destroy', $row->id); } @@ -84,8 +84,8 @@ public function getDataMediaSosial(Request $request) */ public function create() { - $medsos = null; - $page_title = 'Media Sosial'; + $medsos = null; + $page_title = 'Media Sosial'; $page_description = 'Tambah Media Sosial'; return view('informasi.media_sosial.create', compact('page_title', 'page_description', 'medsos')); @@ -101,17 +101,18 @@ public function store(MediaSosialRequest $request) try { $input = $request->validated(); if ($request->hasFile('logo')) { - $file = $request->file('logo'); + $file = $request->file('logo'); $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/medsos/"; + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/medsos/'; $file->move($path, $file_name); - $input['logo'] = $path . $file_name; + $input['logo'] = $path.$file_name; } MediaSosial::create($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Media Sosial gagal disimpan!'); } @@ -121,14 +122,14 @@ public function store(MediaSosialRequest $request) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * @return Response */ public function edit($id) { - $medsos = MediaSosial::findOrFail($id); - $page_title = 'Media Sosial'; - $page_description = 'Ubah Media Sosial : ' . $medsos->nama; + $medsos = MediaSosial::findOrFail($id); + $page_title = 'Media Sosial'; + $page_description = 'Ubah Media Sosial : '.$medsos->nama; return view('informasi.media_sosial.edit', compact('page_title', 'page_description', 'medsos')); } @@ -136,10 +137,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * @return Response */ - public function update(MediaSosialRequest $request, $id) { $medsos = MediaSosial::findOrFail($id); @@ -148,18 +148,19 @@ public function update(MediaSosialRequest $request, $id) $input = $request->validated(); if ($request->hasFile('logo')) { - $file = $request->file('logo'); - $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/medsos/"; + $file = $request->file('logo'); + $original_name = strtolower(trim($file->getClientOriginalName())); + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/medsos/'; $file->move($path, $file_name); - unlink(base_path('public/' . $medsos->logo)); - $input['logo'] = $path . $file_name; + unlink(base_path('public/'.$medsos->logo)); + $input['logo'] = $path.$file_name; } $medsos->update($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Media Sosial gagal diubah!'); } @@ -169,7 +170,7 @@ public function update(MediaSosialRequest $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * @return Response */ public function destroy($id) @@ -177,10 +178,11 @@ public function destroy($id) try { $medsos = MediaSosial::findOrFail($id); if ($medsos->delete()) { - unlink(base_path('public/' . $medsos->logo)); + unlink(base_path('public/'.$medsos->logo)); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.media-sosial.index')->with('error', 'Media Sosial gagal dihapus!'); } diff --git a/app/Http/Controllers/Informasi/PotensiController.php b/app/Http/Controllers/Informasi/PotensiController.php index c9f361b40..163264dbd 100644 --- a/app/Http/Controllers/Informasi/PotensiController.php +++ b/app/Http/Controllers/Informasi/PotensiController.php @@ -31,25 +31,42 @@ namespace App\Http\Controllers\Informasi; -use App\Http\Controllers\Controller; -use App\Http\Requests\PotensiRequest; use App\Models\Potensi; use App\Models\TipePotensi; +use App\Http\Controllers\Controller; +use App\Http\Requests\PotensiRequest; +use Yajra\DataTables\Facades\DataTables; class PotensiController extends Controller { public function index() { - $page_title = 'Potensi'; + $page_title = 'Potensi'; $page_description = 'Daftar Potensi'; - $potensis = Potensi::latest()->paginate(10); + $kategoriPotensi = TipePotensi::all(); - return view('informasi.potensi.index', compact('page_title', 'page_description', 'potensis')); + return view('informasi.potensi.index', compact('page_title', 'page_description', 'kategoriPotensi')); + } + + public function getDataPotensi() + { + return DataTables::of(Potensi::query()) + ->addColumn('aksi', function ($row) { + $data['show_url'] = route('informasi.potensi.show', $row->id); + + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.potensi.edit', $row->id); + $data['delete_url'] = route('informasi.potensi.destroy', $row->id); + } + + return view('forms.aksi', $data); + }) + ->make(); } public function kategori() { - $page_title = 'Potensi'; + $page_title = 'Potensi'; if ($_GET['id'] != null) { $potensis = Potensi::where('kategori_id', $_GET['id'])->latest()->paginate(10); @@ -59,7 +76,7 @@ public function kategori() $kategori = 'Semua'; } - $page_description = 'Kategori Potensi : ' . $kategori; + $page_description = 'Kategori Potensi : '.$kategori; return view('informasi.potensi.index', compact('page_title', 'page_description', 'potensis')); } @@ -80,14 +97,15 @@ public function store(PotensiRequest $request) if ($request->hasFile('file_gambar')) { $lampiran = $request->file('file_gambar'); $fileName = $lampiran->getClientOriginalName(); - $path = "storage/potensi_kecamatan/"; + $path = 'storage/potensi_kecamatan/'; $lampiran->move($path, $fileName); - $input['file_gambar'] = $path . $fileName; + $input['file_gambar'] = $path.$fileName; } Potensi::create($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Simpan Event gagal!'); } @@ -96,7 +114,7 @@ public function store(PotensiRequest $request) public function show(Potensi $potensi) { - $page_title = 'Potensi'; + $page_title = 'Potensi'; $page_description = 'Detail Potensi'; return view('informasi.potensi.show', compact('page_title', 'page_description', 'potensi')); @@ -104,7 +122,7 @@ public function show(Potensi $potensi) public function edit(Potensi $potensi) { - $page_title = 'Potensi'; + $page_title = 'Potensi'; $page_description = 'Ubah Potensi'; return view('informasi.potensi.edit', compact('page_title', 'page_description', 'potensi')); @@ -118,19 +136,20 @@ public function update(PotensiRequest $request, Potensi $potensi) if ($request->hasFile('file_gambar')) { $lampiran = $request->file('file_gambar'); $fileName = $lampiran->getClientOriginalName(); - $path = "storage/potensi_kecamatan/"; + $path = 'storage/potensi_kecamatan/'; $lampiran->move($path, $fileName); - if ($potensi->file_gambar && file_exists(base_path('public/' . $potensi->file_gambar))) { - unlink(base_path('public/' . $potensi->file_gambar)); + if ($potensi->file_gambar && file_exists(base_path('public/'.$potensi->file_gambar))) { + unlink(base_path('public/'.$potensi->file_gambar)); } - $input['file_gambar'] = $path . $fileName; + $input['file_gambar'] = $path.$fileName; } $potensi->update($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Data Potensi gagal disimpan!'); } @@ -141,10 +160,11 @@ public function destroy(Potensi $potensi) { try { if ($potensi->delete()) { - unlink(base_path('public/' . $potensi->file_gambar)); + unlink(base_path('public/'.$potensi->file_gambar)); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.form-dokumen.index')->with('error', 'Potensi gagal dihapus!'); } diff --git a/app/Http/Controllers/Informasi/ProsedurController.php b/app/Http/Controllers/Informasi/ProsedurController.php index 424ebe236..de9f2f8d7 100644 --- a/app/Http/Controllers/Informasi/ProsedurController.php +++ b/app/Http/Controllers/Informasi/ProsedurController.php @@ -40,7 +40,7 @@ class ProsedurController extends Controller { public function index() { - $page_title = 'Prosedur'; + $page_title = 'Prosedur'; $page_description = 'Daftar Prosedur'; return view('informasi.prosedur.index', compact('page_title', 'page_description')); @@ -52,8 +52,8 @@ public function getDataProsedur() ->addColumn('aksi', function ($row) { $data['show_url'] = route('informasi.prosedur.show', $row->id); - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.prosedur.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.prosedur.edit', $row->id); $data['delete_url'] = route('informasi.prosedur.destroy', $row->id); } @@ -68,7 +68,7 @@ public function getDataProsedur() public function create() { - $page_title = 'Prosedur'; + $page_title = 'Prosedur'; $page_description = 'Tambah Prosedur'; return view('informasi.prosedur.create', compact('page_title', 'page_description')); @@ -80,19 +80,20 @@ public function store(ProsedurRequest $request) $input = $request->all(); if ($request->hasFile('file_prosedur')) { - $file = $request->file('file_prosedur'); + $file = $request->file('file_prosedur'); $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/regulasi/"; + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/regulasi/'; $file->move($path, $file_name); $input['slug'] = str_slug($request->input('judul_prosedur')); - $input['file_prosedur'] = $path . $file_name; + $input['file_prosedur'] = $path.$file_name; $input['mime_type'] = $file->getClientOriginalExtension(); } Prosedur::create($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Prosedur gagal disimpan!'); } @@ -101,16 +102,16 @@ public function store(ProsedurRequest $request) public function show(Prosedur $prosedur) { - $page_title = 'Prosedur'; - $page_description = 'Detail Prosedur : ' . $prosedur->judul_prosedur; + $page_title = 'Prosedur'; + $page_description = 'Detail Prosedur : '.$prosedur->judul_prosedur; return view('informasi.prosedur.show', compact('page_title', 'page_description', 'prosedur')); } public function edit(Prosedur $prosedur) { - $page_title = 'Prosedur'; - $page_description = 'Ubah Prosedur : ' . $prosedur->judul_prosedur; + $page_title = 'Prosedur'; + $page_description = 'Ubah Prosedur : '.$prosedur->judul_prosedur; return view('informasi.prosedur.edit', compact('page_title', 'page_description', 'prosedur')); } @@ -121,14 +122,14 @@ public function update(Prosedur $prosedur, ProsedurRequest $request) $input = $request->all(); if ($request->hasFile('file_prosedur')) { - $file = $request->file('file_prosedur'); + $file = $request->file('file_prosedur'); $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/regulasi/"; + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/regulasi/'; $file->move($path, $file_name); - unlink(base_path('public/' . $prosedur->file_prosedur)); + unlink(base_path('public/'.$prosedur->file_prosedur)); - $input['file_prosedur'] = $path . $file_name; + $input['file_prosedur'] = $path.$file_name; $input['mime_type'] = $file->getClientOriginalExtension(); } $input['slug'] = str_slug($request->input('judul_prosedur')); @@ -136,6 +137,7 @@ public function update(Prosedur $prosedur, ProsedurRequest $request) $prosedur->update($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Prosedur gagal disimpan!'); } @@ -146,10 +148,11 @@ public function destroy(Prosedur $prosedur) { try { if ($prosedur->delete()) { - unlink(base_path('public/' . $prosedur->file_prosedur)); + unlink(base_path('public/'.$prosedur->file_prosedur)); } } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Prosedur gagal dihapus!'); } @@ -162,6 +165,7 @@ public function download(Prosedur $prosedur) return response()->download($prosedur->file_prosedur); } catch (\Exception $e) { report($e); + return back()->with('error', 'Dokumen prosedur tidak ditemukan'); } } diff --git a/app/Http/Controllers/Informasi/RegulasiController.php b/app/Http/Controllers/Informasi/RegulasiController.php index 673297f8d..a2891ec53 100644 --- a/app/Http/Controllers/Informasi/RegulasiController.php +++ b/app/Http/Controllers/Informasi/RegulasiController.php @@ -31,24 +31,41 @@ namespace App\Http\Controllers\Informasi; +use App\Models\Regulasi; use App\Http\Controllers\Controller; use App\Http\Requests\RegulasiRequest; -use App\Models\Regulasi; +use Yajra\DataTables\Facades\DataTables; class RegulasiController extends Controller { public function index() { - $page_title = 'Regulasi'; + $page_title = 'Regulasi'; $page_description = 'Daftar Regulasi'; - $regulasi = Regulasi::latest()->paginate(10); // TODO : Gunakan datatable - return view('informasi.regulasi.index', compact('page_title', 'page_description', 'regulasi')); + return view('informasi.regulasi.index', compact('page_title', 'page_description')); + } + + public function getDataRegulasi() + { + return DataTables::of(Regulasi::query()) + ->addColumn('aksi', function ($row) { + $data['show_url'] = route('informasi.regulasi.show', $row->id); + + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.regulasi.edit', $row->id); + $data['delete_url'] = route('informasi.regulasi.destroy', $row->id); + } + + $data['download_url'] = route('informasi.regulasi.download', $row->id); + + return view('forms.aksi', $data); + })->make(); } public function create() { - $page_title = 'Regulasi'; + $page_title = 'Regulasi'; $page_description = 'Tambah Regulasi'; return view('informasi.regulasi.create', compact('page_title', 'page_description')); @@ -63,16 +80,17 @@ public function store(RegulasiRequest $request) if ($request->hasFile('file_regulasi')) { $lampiran1 = $request->file('file_regulasi'); $fileName1 = $lampiran1->getClientOriginalName(); - $path = "storage/regulasi/"; + $path = 'storage/regulasi/'; $request->file('file_regulasi')->move($path, $fileName1); - $input['file_regulasi'] = $path . $fileName1; + $input['file_regulasi'] = $path.$fileName1; $input['mime_type'] = $lampiran1->getClientOriginalExtension(); } Regulasi::create($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Regulasi gagal disimpan!!'); } @@ -81,15 +99,15 @@ public function store(RegulasiRequest $request) public function show(Regulasi $regulasi) { - $page_title = "Regulasi"; - $page_description = "Detail Regulasi"; + $page_title = 'Regulasi'; + $page_description = 'Detail Regulasi'; return view('informasi.regulasi.show', compact('page_title', 'page_description', 'regulasi')); } public function edit(Regulasi $regulasi) { - $page_title = 'Regulasi'; + $page_title = 'Regulasi'; $page_description = 'Ubah Regulasi'; return view('informasi.regulasi.edit', compact('page_title', 'page_description', 'regulasi')); @@ -104,16 +122,17 @@ public function update(RegulasiRequest $request, Regulasi $regulasi) if ($request->hasFile('file_regulasi')) { $lampiran1 = $request->file('file_regulasi'); $fileName1 = $lampiran1->getClientOriginalName(); - $path = "storage/regulasi/"; + $path = 'storage/regulasi/'; $lampiran1->move($path, $fileName1); - unlink(base_path('public/' . $regulasi->file_regulasi)); + unlink(base_path('public/'.$regulasi->file_regulasi)); - $input['file_regulasi'] = $path . $fileName1; + $input['file_regulasi'] = $path.$fileName1; $input['mime_type'] = $lampiran1->getClientOriginalExtension(); } $regulasi->update($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Regulasi gagal disimpan!!'); } @@ -124,10 +143,11 @@ public function destroy(Regulasi $regulasi) { try { if ($regulasi->delete()) { - unlink(base_path('public/' . $regulasi->file_regulasi)); + unlink(base_path('public/'.$regulasi->file_regulasi)); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.regulasi.index')->with('error', 'Regulasi gagal dihapus!'); } @@ -140,6 +160,7 @@ public function download(Regulasi $regulasi) return response()->download($regulasi->file_regulasi); } catch (\Exception $e) { report($e); + return back()->with('error', 'Dokumen regulasi tidak ditemukan'); } } diff --git a/app/Http/Controllers/Informasi/SinergiProgramController.php b/app/Http/Controllers/Informasi/SinergiProgramController.php index 50c3f0418..9a104ca45 100644 --- a/app/Http/Controllers/Informasi/SinergiProgramController.php +++ b/app/Http/Controllers/Informasi/SinergiProgramController.php @@ -57,11 +57,11 @@ public function getDataSinergiProgram(Request $request) ->addColumn('aksi', function ($row) { $data['show_web'] = $row->url; - if (!auth()->guest()) { - $data['edit_url'] = route('informasi.sinergi-program.edit', $row->id); + if (! auth()->guest()) { + $data['edit_url'] = route('informasi.sinergi-program.edit', $row->id); $data['delete_url'] = route('informasi.sinergi-program.destroy', $row->id); - $data['naik'] = route('informasi.sinergi-program.urut', [$row->id, -1]); - $data['turun'] = route('informasi.sinergi-program.urut', [$row->id, 1]); + $data['naik'] = route('informasi.sinergi-program.urut', [$row->id, -1]); + $data['turun'] = route('informasi.sinergi-program.urut', [$row->id, 1]); } return view('forms.aksi', $data); @@ -74,7 +74,7 @@ public function getDataSinergiProgram(Request $request) } }) ->editColumn('gambar', function ($row) { - return ''; + return ''; }) ->rawColumns(['status']) ->escapeColumns([]) @@ -89,8 +89,8 @@ public function getDataSinergiProgram(Request $request) */ public function create() { - $sinergi = null; - $page_title = 'Sinergi Program'; + $sinergi = null; + $page_title = 'Sinergi Program'; $page_description = 'Tambah Sinergi Program'; return view('informasi.sinergi_program.create', compact('page_title', 'page_description', 'sinergi')); @@ -106,16 +106,17 @@ public function store(SinergiProgramRequest $request) try { $input = $request->validated(); if ($request->hasFile('gambar')) { - $file = $request->file('gambar'); - $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/sinergi/"; + $file = $request->file('gambar'); + $original_name = strtolower(trim($file->getClientOriginalName())); + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/sinergi/'; $file->move($path, $file_name); - $input['gambar'] = $path . $file_name; + $input['gambar'] = $path.$file_name; } SinergiProgram::create($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Sinergi Program gagal disimpan!'); } @@ -125,14 +126,14 @@ public function store(SinergiProgramRequest $request) /** * Show the form for editing the specified resource. * - * @param int $id + * @param int $id * @return Response */ public function edit($id) { - $sinergi = SinergiProgram::findOrFail($id); - $page_title = 'Sinergi Program'; - $page_description = 'Ubah Sinergi Program : ' . $sinergi->nama; + $sinergi = SinergiProgram::findOrFail($id); + $page_title = 'Sinergi Program'; + $page_description = 'Ubah Sinergi Program : '.$sinergi->nama; return view('informasi.sinergi_program.edit', compact('page_title', 'page_description', 'sinergi')); } @@ -140,10 +141,9 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param int $id + * @param int $id * @return Response */ - public function update(SinergiProgramRequest $request, $id) { $sinergi = SinergiProgram::findOrFail($id); @@ -152,18 +152,19 @@ public function update(SinergiProgramRequest $request, $id) $input = $request->validated(); if ($request->hasFile('gambar')) { - $file = $request->file('gambar'); - $original_name = strtolower(trim($file->getClientOriginalName())); - $file_name = time() . rand(100, 999) . '_' . $original_name; - $path = "storage/sinergi/"; + $file = $request->file('gambar'); + $original_name = strtolower(trim($file->getClientOriginalName())); + $file_name = time().rand(100, 999).'_'.$original_name; + $path = 'storage/sinergi/'; $file->move($path, $file_name); - unlink(base_path('public/' . $sinergi->gambar)); - $input['gambar'] = $path . $file_name; + unlink(base_path('public/'.$sinergi->gambar)); + $input['gambar'] = $path.$file_name; } $sinergi->update($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Sinergi Program gagal diubah!'); } @@ -173,7 +174,7 @@ public function update(SinergiProgramRequest $request, $id) /** * Remove the specified resource from storage. * - * @param int $id + * @param int $id * @return Response */ public function destroy($id) @@ -181,10 +182,11 @@ public function destroy($id) try { $sinergi = SinergiProgram::findOrFail($id); if ($sinergi->delete()) { - unlink(base_path('public/' . $sinergi->gambar)); + unlink(base_path('public/'.$sinergi->gambar)); } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.sinergi-program.index')->with('error', 'Sinergi Program gagal dihapus!'); } @@ -194,7 +196,7 @@ public function destroy($id) /** * Update urutan daftar sinergi program. * - * @param int $id, $urutan + * @param int $id, $urutan * @return Response */ public function urut($id, $urutan) @@ -212,6 +214,7 @@ public function urut($id, $urutan) } } catch (\Exception $e) { report($e); + return redirect()->route('informasi.sinergi-program.index')->with('error', 'Urutan Sinergi Program gagal diubah!'); } diff --git a/app/Http/Controllers/LogViewerController.php b/app/Http/Controllers/LogViewerController.php index 9ab597875..37edc1662 100644 --- a/app/Http/Controllers/LogViewerController.php +++ b/app/Http/Controllers/LogViewerController.php @@ -39,7 +39,6 @@ /** * Class LogViewerController - * @package Rap2hpoutre\LaravelLogViewer */ class LogViewerController extends Controller { @@ -47,10 +46,15 @@ class LogViewerController extends Controller * @var \Illuminate\Http\Request */ protected $request; + private $log_viewer; + protected $view_log = 'laravel-log-viewer::index'; + protected $profil; + protected $requirements; + /** * LogViewerController constructor. */ @@ -61,11 +65,12 @@ public function __construct(Controller $profil, RequirementsChecker $checker) $this->profil = $profil; $this->requirements = $checker; } + /** * @return array|mixed + * * @throws \Exception */ - public function index() { $folderFiles = []; @@ -100,7 +105,7 @@ public function index() if (is_array($data['logs']) && count($data['logs']) > 0) { $firstLog = reset($data['logs']); - if (!$firstLog['context'] && !$firstLog['level']) { + if (! $firstLog['context'] && ! $firstLog['level']) { $data['standardFormat'] = false; } } @@ -122,6 +127,7 @@ public function index() /** * @return bool|mixed + * * @throws \Exception */ private function earlyReturn() @@ -134,9 +140,11 @@ private function earlyReturn() return $this->download($this->pathFromInput('dl')); } elseif ($this->request->has('clean')) { app('files')->put($this->pathFromInput('clean'), ''); + return $this->redirect(url()->previous()); } elseif ($this->request->has('del')) { app('files')->delete($this->pathFromInput('del')); + return $this->redirect($this->request->url()); } elseif ($this->request->has('delall')) { $files = ($this->log_viewer->getFolderName()) @@ -145,14 +153,17 @@ private function earlyReturn() foreach ($files as $file) { app('files')->delete($this->log_viewer->pathToLogFile($file)); } + return $this->redirect($this->request->url()); } + return false; } /** - * @param string $input_string + * @param string $input_string * @return string + * * @throws \Exception */ private function pathFromInput($input_string) @@ -161,7 +172,6 @@ private function pathFromInput($input_string) } /** - * @param $to * @return mixed */ private function redirect($to) @@ -174,7 +184,7 @@ private function redirect($to) } /** - * @param string $data + * @param string $data * @return mixed */ private function download($data) @@ -203,7 +213,7 @@ public function queueListen() report($e); return response()->json([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ], Response::HTTP_INTERNAL_SERVER_ERROR); } diff --git a/app/Http/Controllers/Page/AnggaranRealisasiController.php b/app/Http/Controllers/Page/AnggaranRealisasiController.php index 356ed329b..eb0b93efe 100644 --- a/app/Http/Controllers/Page/AnggaranRealisasiController.php +++ b/app/Http/Controllers/Page/AnggaranRealisasiController.php @@ -45,10 +45,10 @@ public function showAnggaranDanRealisasi() { Counter::count('statistik.anggaran-dan-realisasi'); - $data['page_title'] = 'Anggaran & Realisasi'; + $data['page_title'] = 'Anggaran & Realisasi'; $data['page_description'] = 'Data Anggaran & Realisasi'; - $data['year_list'] = years_list(); - $data['list_desa'] = DataDesa::all(); + $data['year_list'] = years_list(); + $data['list_desa'] = DataDesa::all(); return view('pages.anggaran_realisasi.show_anggaran_realisasi')->with($data); } @@ -56,17 +56,17 @@ public function showAnggaranDanRealisasi() // TODO : Sederhanakan, buat jadi 1 kondisi yg lebih fleksibel. public function getChartAnggaranRealisasi() { - $mid = request('mid'); + $mid = request('mid'); $year = request('y'); // Grafik Data Pendidikan $data_pendidikan = []; if ($year == 'Semua') { - $total_anggaran = 0; - $total_belanja = 0; - $belanja_pegawai = 0; - $belanja_barang_jasa = 0; - $belanja_modal = 0; + $total_anggaran = 0; + $total_belanja = 0; + $belanja_pegawai = 0; + $belanja_barang_jasa = 0; + $belanja_modal = 0; $belanja_tidak_langsung = 0; foreach (array_sort(years_list()) as $yearls) { @@ -80,61 +80,61 @@ public function getChartAnggaranRealisasi() $res = $query_result->first(); - if (!empty($res)) { - $total_anggaran = $res->total_anggaran; - $total_belanja = $res->total_belanja; - $belanja_pegawai = $res->belanja_pegawai; - $belanja_barang_jasa = $res->belanja_barang_jasa; - $belanja_modal = $res->belanja_modal; + if (! empty($res)) { + $total_anggaran = $res->total_anggaran; + $total_belanja = $res->total_belanja; + $belanja_pegawai = $res->belanja_pegawai; + $belanja_barang_jasa = $res->belanja_barang_jasa; + $belanja_modal = $res->belanja_modal; $belanja_tidak_langsung = $res->belanja_tidak_langsung; } else { - $total_anggaran += 0; - $total_belanja += 0; - $belanja_pegawai += 0; - $belanja_barang_jasa += 0; - $belanja_modal += 0; + $total_anggaran += 0; + $total_belanja += 0; + $belanja_pegawai += 0; + $belanja_barang_jasa += 0; + $belanja_modal += 0; $belanja_tidak_langsung += 0; } } - $data_pendidikan['sum'] = [ - 'total_belanja' => (float) ($total_belanja), - 'total_belanja_persen' => (float) (($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100), - 'selisih_anggaran_realisasi' => (float)(0), - 'selisih_anggaran_realisasi_persen' => (float)(0), - 'belanja_pegawai' => (float)($belanja_pegawai), - 'belanja_pegawai_persen' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), - 'belanja_barang_jasa' => (float)($belanja_barang_jasa), - 'belanja_barang_jasa_persen' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), - 'belanja_modal' => (float)($belanja_modal), - 'belanja_modal_persen' => (float)(($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), - 'belanja_tidak_langsung' => (float)($belanja_tidak_langsung), - 'belanja_tidak_langsung_persen' => (float)(($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), + $data_pendidikan['sum'] = [ + 'total_belanja' => (float) ($total_belanja), + 'total_belanja_persen' => (float) (($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100), + 'selisih_anggaran_realisasi' => (float) (0), + 'selisih_anggaran_realisasi_persen' => (float) (0), + 'belanja_pegawai' => (float) ($belanja_pegawai), + 'belanja_pegawai_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), + 'belanja_barang_jasa' => (float) ($belanja_barang_jasa), + 'belanja_barang_jasa_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), + 'belanja_modal' => (float) ($belanja_modal), + 'belanja_modal_persen' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), + 'belanja_tidak_langsung' => (float) ($belanja_tidak_langsung), + 'belanja_tidak_langsung_persen' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), ]; $data_pendidikan['chart'] = [ [ 'anggaran' => 'Belanja Pegawai', - 'value' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), + 'value' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Barang dan Jasa', - 'value' => (float)(($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), + 'value' => (float) (($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Modal', - 'value' => (float)(($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), + 'value' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Tidak Langsung', - 'value' => (float)(($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), + 'value' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), ], ]; } else { - $total_anggaran = 0; - $total_belanja = 0; - $belanja_pegawai = 0; - $belanja_barang_jasa = 0; - $belanja_modal = 0; + $total_anggaran = 0; + $total_belanja = 0; + $belanja_pegawai = 0; + $belanja_barang_jasa = 0; + $belanja_modal = 0; $belanja_tidak_langsung = 0; $query_result = DB::table('das_anggaran_realisasi') @@ -150,45 +150,45 @@ public function getChartAnggaranRealisasi() $res = $query_result->first(); - if (!empty($res)) { - $total_anggaran = $res->total_anggaran; - $total_belanja = $res->total_belanja; - $belanja_pegawai = $res->belanja_pegawai; - $belanja_barang_jasa = $res->belanja_barang_jasa; - $belanja_modal = $res->belanja_modal; + if (! empty($res)) { + $total_anggaran = $res->total_anggaran; + $total_belanja = $res->total_belanja; + $belanja_pegawai = $res->belanja_pegawai; + $belanja_barang_jasa = $res->belanja_barang_jasa; + $belanja_modal = $res->belanja_modal; $belanja_tidak_langsung = $res->belanja_tidak_langsung; } - $data_pendidikan['sum'] = [ - 'total_belanja' => (float)($total_belanja), - 'total_belanja_persen' => (float)(($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100), - 'selisih_anggaran_realisasi' => (float)(0), - 'selisih_anggaran_realisasi_persen' => (float)(0), - 'belanja_pegawai' => (float)($belanja_pegawai), - 'belanja_pegawai_persen' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), - 'belanja_barang_jasa' => (float)($belanja_barang_jasa), - 'belanja_barang_jasa_persen' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), - 'belanja_modal' => (float)($belanja_modal), - 'belanja_modal_persen' => (float)(($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), - 'belanja_tidak_langsung' => (float)($belanja_tidak_langsung), - 'belanja_tidak_langsung_persen' => (float)(($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), + $data_pendidikan['sum'] = [ + 'total_belanja' => (float) ($total_belanja), + 'total_belanja_persen' => (float) (($total_belanja == 0) ? 0 : ($total_belanja / $total_anggaran) * 100), + 'selisih_anggaran_realisasi' => (float) (0), + 'selisih_anggaran_realisasi_persen' => (float) (0), + 'belanja_pegawai' => (float) ($belanja_pegawai), + 'belanja_pegawai_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), + 'belanja_barang_jasa' => (float) ($belanja_barang_jasa), + 'belanja_barang_jasa_persen' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), + 'belanja_modal' => (float) ($belanja_modal), + 'belanja_modal_persen' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), + 'belanja_tidak_langsung' => (float) ($belanja_tidak_langsung), + 'belanja_tidak_langsung_persen' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), ]; $data_pendidikan['chart'] = [ [ 'anggaran' => 'Belanja Pegawai', - 'value' => (float)(($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), + 'value' => (float) (($belanja_pegawai == 0) ? 0 : ($belanja_pegawai / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Barang dan Jasa', - 'value' => (float)(($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), + 'value' => (float) (($belanja_barang_jasa == 0) ? 0 : ($belanja_barang_jasa / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Modal', - 'value' => (float)(($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), + 'value' => (float) (($belanja_modal == 0) ? 0 : ($belanja_modal / $total_belanja) * 100), ], [ 'anggaran' => 'Belanja Tidak Langsung', - 'value' => (float)(($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), + 'value' => (float) (($belanja_tidak_langsung == 0) ? 0 : ($belanja_tidak_langsung / $total_belanja) * 100), ], ]; } diff --git a/app/Http/Controllers/Pesan/PesanController.php b/app/Http/Controllers/Pesan/PesanController.php index c678de417..6ca1f23b6 100644 --- a/app/Http/Controllers/Pesan/PesanController.php +++ b/app/Http/Controllers/Pesan/PesanController.php @@ -55,16 +55,19 @@ public function index(Request $request) ->where('diarsipkan', Pesan::NON_ARSIP) ->orderBy('sudah_dibaca', 'ASC') ->orderBy('created_at', 'DESC') - ->when(!empty($request->get('desa_id')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('desa_id')), function ($q) use ($request, &$data) { $data->put('desa_id', $request->get('desa_id')); + return $q->where('das_data_desa_id', $request->get('desa_id')); }) - ->when(!empty($request->get('q')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('q')), function ($q) use ($request, &$data) { $data->put('search_query', $request->get('q')); + return $q->where('judul', 'LIKE', "%{$request->get('q')}%"); }) ->when($request->get('sudahdibaca') !== null, function ($q) use ($request, &$data) { $data->put('sudah_dibaca', $request->get('sudahdibaca')); + return $q->where('sudah_dibaca', (int) $request->get('sudahdibaca')); }) ->paginate(Pesan::PER_PAGE); @@ -78,11 +81,11 @@ public function index(Request $request) protected function loadCounter() { - $counter_unread = Pesan::where([ + $counter_unread = Pesan::where([ 'jenis' => Pesan::PESAN_MASUK, 'diarsipkan' => Pesan::NON_ARSIP, 'sudah_dibaca' => Pesan::BELUM_DIBACA])->count(); - $counter_unread_keluar = Pesan::where([ + $counter_unread_keluar = Pesan::where([ 'jenis' => Pesan::PESAN_KELUAR, 'diarsipkan' => Pesan::NON_ARSIP, 'sudah_dibaca' => Pesan::BELUM_DIBACA])->count(); @@ -90,7 +93,7 @@ protected function loadCounter() return [ 'counter_unread' => $counter_unread, 'counter_unread_keluar' => $counter_unread_keluar, - ]; + ]; } public function loadPesanKeluar(Request $request) @@ -106,12 +109,14 @@ public function loadPesanKeluar(Request $request) ->where('jenis', Pesan::PESAN_KELUAR) ->where('diarsipkan', Pesan::NON_ARSIP) ->orderBy('created_at', 'DESC') - ->when(!empty($request->get('desa_id')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('desa_id')), function ($q) use ($request, &$data) { $data->put('desa_id', $request->get('desa_id')); + return $q->where('das_data_desa_id', $request->get('desa_id')); }) - ->when(!empty($request->get('q')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('q')), function ($q) use ($request, &$data) { $data->put('search_query', $request->get('q')); + return $q->where('judul', 'LIKE', "%{$request->get('q')}%"); }) ->paginate(Pesan::PER_PAGE); @@ -135,12 +140,14 @@ public function loadPesanArsip(Request $request) $pesan = Pesan::with(['dataDesa', 'detailPesan']) ->where('diarsipkan', Pesan::MASUK_ARSIP) ->orderBy('created_at', 'DESC') - ->when(!empty($request->get('desa_id')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('desa_id')), function ($q) use ($request, &$data) { $data->put('desa_id', $request->get('desa_id')); + return $q->where('das_data_desa_id', $request->get('desa_id')); }) - ->when(!empty($request->get('q')), function ($q) use ($request, &$data) { + ->when(! empty($request->get('q')), function ($q) use ($request, &$data) { $data->put('search_query', $request->get('q')); + return $q->where('judul', 'LIKE', "%{$request->get('q')}%"); }) ->paginate(Pesan::PER_PAGE); @@ -148,12 +155,13 @@ public function loadPesanArsip(Request $request) $list_desa = DataDesa::get(); $data->put('list_pesan', $pesan); $data->put('list_desa', $list_desa); + return view('pesan.arsip.index', $data->all()); } public function readPesan($id_pesan) { - $pesan = Pesan::findOrFail($id_pesan); + $pesan = Pesan::findOrFail($id_pesan); if ($pesan->sudah_dibaca == Pesan::BELUM_DIBACA) { $pesan->sudah_dibaca = Pesan::SUDAH_DIBACA; $pesan->save(); @@ -164,6 +172,7 @@ public function readPesan($id_pesan) $data->put('page_description', 'Managemen Pesan'); $data->put('pesan', $pesan); $data = $data->merge($this->loadCounter()); + return view('pesan.read_pesan', $data->all()); } @@ -175,6 +184,7 @@ public function composePesan() $list_desa = DataDesa::get(); $data = $data->merge($this->loadCounter()); $data->put('list_desa', $list_desa); + return view('pesan.compose_pesan', $data->all()); } @@ -185,9 +195,9 @@ public function storeComposePesan(Request $request) { try { $this->validate($request, [ - 'judul' => 'required', + 'judul' => 'required', 'das_data_desa_id' => 'required|exists:das_data_desa,id', - 'text' => 'required' + 'text' => 'required', ]); DB::transaction(function () use ($request) { @@ -202,13 +212,13 @@ public function storeComposePesan(Request $request) 'pesan_id' => $id, 'text' => Purify::clean($request->get('text')), 'pengirim' => 'kecamatan', - 'nama_pengirim' => 'kecamatan - '. auth()->user()->name, + 'nama_pengirim' => 'kecamatan - '.auth()->user()->name, ]); }); return redirect()->route('pesan.keluar')->with('success', 'Pesan berhasil dikirim!'); } catch (\Exception $e) { - return back()->withInput()->with('error', 'Pesan gagal dikirim!. Detail: ' . $e->getMessage()); + return back()->withInput()->with('error', 'Pesan gagal dikirim!. Detail: '.$e->getMessage()); } } @@ -219,6 +229,7 @@ public function setArsipPesan(Request $request) if ($pesan->save()) { return redirect()->route('pesan.arsip')->with('success', 'Pesan berhasil diarsipkan!'); } + return back()->withInput()->with('error', 'Pesan gagal diarsipkan!'); } @@ -226,12 +237,13 @@ public function setMultipleReadPesanStatus(Request $request) { $array = json_decode($request->get('array_id')); $pesan = Pesan::whereIn('id', $array)->update([ - 'sudah_dibaca' => Pesan::SUDAH_DIBACA + 'sudah_dibaca' => Pesan::SUDAH_DIBACA, ]); if ($pesan > 0) { return back()->with('success', 'Pesan berhasil ditandai!'); } + return back()->withInput()->with('error', 'Pesan gagal ditandai!'); } @@ -239,12 +251,13 @@ public function setMultipleArsipPesanStatus(Request $request) { $array = json_decode($request->get('array_id')); $pesan = Pesan::whereIn('id', $array)->update([ - 'diarsipkan' => Pesan::MASUK_ARSIP + 'diarsipkan' => Pesan::MASUK_ARSIP, ]); if ($pesan > 0) { return back()->with('success', 'Pesan berhasil ditandai!'); } + return back()->withInput()->with('error', 'Pesan gagal diarsipkan!'); } @@ -254,12 +267,13 @@ public function replyPesan(Request $request) 'pesan_id' => $request->get('id'), 'text' => Purify::clean($request->get('text')), 'pengirim' => 'kecamatan', - 'nama_pengirim' => 'kecamatan - '. auth()->user()->name + 'nama_pengirim' => 'kecamatan - '.auth()->user()->name, ]); if ($pesan) { return back()->with('success', 'Pesan berhasil dikirim!'); } + return back()->withInput()->with('error', 'Pesan gagal dikirim!'); } } diff --git a/app/Http/Controllers/Role/RoleController.php b/app/Http/Controllers/Role/RoleController.php index 4920db3a5..6ee338c51 100644 --- a/app/Http/Controllers/Role/RoleController.php +++ b/app/Http/Controllers/Role/RoleController.php @@ -49,7 +49,7 @@ class RoleController extends Controller */ public function index() { - $page_title = 'Group Pengguna'; + $page_title = 'Group Pengguna'; $page_description = 'Daftar Data'; return view('role.index', compact('page_title', 'page_description')); @@ -64,7 +64,7 @@ public function getData() { return DataTables::of(Role::datatables()) ->addColumn('aksi', function ($role) { - $data['edit_url'] = route('setting.role.edit', $role->id); + $data['edit_url'] = route('setting.role.edit', $role->id); $data['delete_url'] = route('setting.role.destroy', $role->id); return view('forms.aksi', $data); @@ -80,7 +80,7 @@ public function getData() public function create() { $permissions = Role::getListPermission(); - $page_title = 'Group Pengguna'; + $page_title = 'Group Pengguna'; $page_description = 'Tambah Group Pengguna'; return view('role.create', compact('page_title', 'page_description', 'permissions')); @@ -89,24 +89,24 @@ public function create() /** * Store a newly created resource in storage. * - * @param Request $request + * @param Request $request * @return Response */ public function store(RoleRequest $request) { try { $temp = []; - if (!empty($request->permissions)) { + if (! empty($request->permissions)) { foreach ($request->permissions as $key => $value) { $temp[$key] = $value == 1 ? true : false; } } $request['permissions'] = $temp; - $role = Role::create($request->all()); + $role = Role::create($request->all()); flash()->success(trans('message.role.create-success', [ 'attribute' => trans('island.role'), - 'detail' => '#' . $role->id . ' | ' . $role->slug, + 'detail' => '#'.$role->id.' | '.$role->slug, ])); return redirect()->route('setting.role.index'); @@ -128,10 +128,10 @@ public function store(RoleRequest $request) */ public function edit($id) { - $role = Role::findOrFail($id); - $permissions = Role::getListPermission(); - $menu = Menu::get(); - $page_title = 'Group Pengguna'; + $role = Role::findOrFail($id); + $permissions = Role::getListPermission(); + $menu = Menu::get(); + $page_title = 'Group Pengguna'; $page_description = 'Ubah Data'; return view('role.edit', compact('page_title', 'page_description', 'role', 'permissions', 'menu')); @@ -156,11 +156,12 @@ public function update(Request $request, $id) $role = Role::findOrFail($id); flash()->success(trans('message.role.update-success', [ 'attribute' => trans('island.role'), - 'detail' => '#' . $role->id . ' | ' . $role->slug, + 'detail' => '#'.$role->id.' | '.$role->slug, ])); } else { Role::findOrFail($id)->update(['name' => $request->name, 'permissions' => []]); } + return redirect()->route('setting.role.index'); } catch (\Exception $e) { report($e); @@ -191,6 +192,7 @@ public function destroy($id) $role = Role::findOrFail($id); $role->delete(); flash()->success(trans('general.destroy-success')); + return redirect()->route('setting.role.index'); } } catch (\Exception $e) { diff --git a/app/Http/Controllers/Setting/AplikasiController.php b/app/Http/Controllers/Setting/AplikasiController.php index 23ddb6b9a..31ab20ab4 100644 --- a/app/Http/Controllers/Setting/AplikasiController.php +++ b/app/Http/Controllers/Setting/AplikasiController.php @@ -42,17 +42,17 @@ public function index() $settings = SettingAplikasi::where('kategori', '!=', 'surat')->get(); if ($settings->isEmpty()) { SettingAplikasi::insert([ - 'key' => SettingAplikasi::KEY_BROWSER_TITLE, - 'value' => $this->browser_title, - 'type' => "input", - 'description' => "Judul halaman aplikasi.", - 'kategori' => "-", - 'option' => '{}' + 'key' => SettingAplikasi::KEY_BROWSER_TITLE, + 'value' => $this->browser_title, + 'type' => 'input', + 'description' => 'Judul halaman aplikasi.', + 'kategori' => '-', + 'option' => '{}', ]); $settings = SettingAplikasi::all(); } - $page_title = 'Pegaturan Aplikasi'; + $page_title = 'Pegaturan Aplikasi'; $page_description = 'Daftar Pegaturan Aplikasi'; return view('setting.aplikasi.index', compact('page_title', 'page_description', 'settings')); @@ -60,8 +60,8 @@ public function index() public function edit(SettingAplikasi $aplikasi) { - $page_title = 'Pengaturan Aplikasi'; - $page_description = 'Ubah Pengaturan Aplikasi'; + $page_title = 'Pengaturan Aplikasi'; + $page_description = 'Ubah Pengaturan Aplikasi'; return view('setting.aplikasi.edit', compact('page_title', 'page_description', 'aplikasi')); } @@ -80,6 +80,7 @@ public function update(Request $request, $id) $this->browser_title = $request->input('value'); } catch (\Exception $e) { report($e); + return back()->with('error', 'Pengaturan aplikasi gagal diubah!'); } diff --git a/app/Http/Controllers/Setting/COAController.php b/app/Http/Controllers/Setting/COAController.php index 61591fd37..e5ae53e6b 100644 --- a/app/Http/Controllers/Setting/COAController.php +++ b/app/Http/Controllers/Setting/COAController.php @@ -42,7 +42,7 @@ class COAController extends Controller { public function index() { - $page_title = 'COA'; + $page_title = 'COA'; $page_description = 'Daftar COA'; return view('setting.coa.index', compact('page_title', 'page_description')); @@ -50,7 +50,7 @@ public function index() public function create() { - $page_title = "COA"; + $page_title = 'COA'; $page_description = 'Tambah COA'; return view('setting.coa.create', compact('page_title', 'page_description')); @@ -59,24 +59,25 @@ public function create() public function store(Request $request) { request()->validate([ - 'type_id' => 'required', - 'sub_id' => 'required', + 'type_id' => 'required', + 'sub_id' => 'required', 'sub_sub_id' => 'required', - 'coa_name' => 'required', - 'id' => 'required', + 'coa_name' => 'required', + 'id' => 'required', ]); try { $data = [ - 'type_id' => $request->input('type_id'), - 'sub_id' => $request->input('sub_id'), + 'type_id' => $request->input('type_id'), + 'sub_id' => $request->input('sub_id'), 'sub_sub_id' => $request->input('sub_sub_id'), - 'coa_name' => $request->input('coa_name'), - 'id' => $request->input('id'), + 'coa_name' => $request->input('coa_name'), + 'id' => $request->input('id'), ]; DB::table('ref_coa')->insert($data); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Akun COA gagal disimpan!'); } diff --git a/app/Http/Controllers/Setting/JenisPenyakitController.php b/app/Http/Controllers/Setting/JenisPenyakitController.php index 54ea423fd..0f2a3dc5f 100644 --- a/app/Http/Controllers/Setting/JenisPenyakitController.php +++ b/app/Http/Controllers/Setting/JenisPenyakitController.php @@ -40,7 +40,7 @@ class JenisPenyakitController extends Controller { public function index() { - $page_title = 'Jenis Penyakit'; + $page_title = 'Jenis Penyakit'; $page_description = 'Daftar Jenis Penyakit'; return view('setting.jenis_penyakit.index', compact('page_title', 'page_description')); @@ -51,7 +51,7 @@ public function getData() { return DataTables::of(JenisPenyakit::all()) ->addColumn('aksi', function ($row) { - $data['edit_url'] = route('setting.jenis-penyakit.edit', $row->id); + $data['edit_url'] = route('setting.jenis-penyakit.edit', $row->id); $data['delete_url'] = route('setting.jenis-penyakit.destroy', $row->id); return view('forms.aksi', $data); @@ -62,7 +62,7 @@ public function getData() // Create Action public function create() { - $page_title = 'Jenis Penyakit'; + $page_title = 'Jenis Penyakit'; $page_description = 'Tambah Jenis Penyakit'; return view('setting.jenis_penyakit.create', compact('page_title', 'page_description')); @@ -80,6 +80,7 @@ public function store(Request $request) $penyakit->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Data gagal disimpan!'); } @@ -88,9 +89,9 @@ public function store(Request $request) public function edit($id) { - $penyakit = JenisPenyakit::findOrFail($id); - $page_title = 'Jenis Penyakit'; - $page_description = 'Ubah Jenis Penyakit : ' . $penyakit->nama; + $penyakit = JenisPenyakit::findOrFail($id); + $page_title = 'Jenis Penyakit'; + $page_description = 'Ubah Jenis Penyakit : '.$penyakit->nama; return view('setting.jenis_penyakit.edit', compact('page_title', 'page_description', 'penyakit')); } @@ -107,6 +108,7 @@ public function update(Request $request, $id) $penyakit->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Data gagal diupdate!'); } @@ -119,6 +121,7 @@ public function destroy($id) JenisPenyakit::findOrFail($id)->delete(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Data gagal dihapus!'); } diff --git a/app/Http/Controllers/Setting/KategoriKomplainController.php b/app/Http/Controllers/Setting/KategoriKomplainController.php index 1ebc21f33..a294f03a2 100644 --- a/app/Http/Controllers/Setting/KategoriKomplainController.php +++ b/app/Http/Controllers/Setting/KategoriKomplainController.php @@ -40,7 +40,7 @@ class KategoriKomplainController extends Controller { public function index() { - $page_title = 'Kategori Komplain'; + $page_title = 'Kategori Komplain'; $page_description = 'Daftar Kategori Komplain'; return view('setting.komplain_kategori.index', compact('page_title', 'page_description')); @@ -51,7 +51,7 @@ public function getData() { return DataTables::of(KategoriKomplain::all()) ->addColumn('aksi', function ($row) { - $data['edit_url'] = route('setting.komplain-kategori.edit', $row->id); + $data['edit_url'] = route('setting.komplain-kategori.edit', $row->id); $data['delete_url'] = route('setting.komplain-kategori.destroy', $row->id); return view('forms.aksi', $data); @@ -62,7 +62,7 @@ public function getData() // Create Action public function create() { - $page_title = 'Kategori Komplain'; + $page_title = 'Kategori Komplain'; $page_description = 'Tambah Kategori Komplain'; return view('setting.komplain_kategori.create', compact('page_title', 'page_description')); @@ -76,10 +76,11 @@ public function store(Request $request) ]); try { - $kategori = new KategoriKomplain($request->all()); + $kategori = new KategoriKomplain($request->all()); $kategori->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Kategori Komplain gagal dikirim!'); } @@ -88,9 +89,9 @@ public function store(Request $request) public function edit($id) { - $kategori = KategoriKomplain::findOrFail($id); - $page_title = 'Kategori Komplain'; - $page_description = 'Ubah Kategori Komplain : ' . $kategori->nama; + $kategori = KategoriKomplain::findOrFail($id); + $page_title = 'Kategori Komplain'; + $page_description = 'Ubah Kategori Komplain : '.$kategori->nama; return view('setting.komplain_kategori.edit', compact('page_title', 'page_description', 'kategori')); } @@ -107,6 +108,7 @@ public function update(Request $request, $id) $kategori->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Kategori Komplain gagal diupdate!'); } @@ -119,6 +121,7 @@ public function destroy($id) KategoriKomplain::findOrFail($id)->delete(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Kategori Komplain gagal dihapus!'); } diff --git a/app/Http/Controllers/Setting/SlideController.php b/app/Http/Controllers/Setting/SlideController.php index c2be298c3..91d61ed51 100644 --- a/app/Http/Controllers/Setting/SlideController.php +++ b/app/Http/Controllers/Setting/SlideController.php @@ -40,7 +40,7 @@ class SlideController extends Controller { public function index() { - $page_title = 'Slide'; + $page_title = 'Slide'; $page_description = 'Daftar Slide'; return view('setting.slide.index', compact('page_title', 'page_description')); @@ -50,7 +50,7 @@ public function getData() { return DataTables::of(Slide::all()) ->addColumn('aksi', function ($row) { - $data['edit_url'] = route('setting.slide.edit', $row->id); + $data['edit_url'] = route('setting.slide.edit', $row->id); $data['delete_url'] = route('setting.slide.destroy', $row->id); return view('forms.aksi', $data); @@ -62,8 +62,8 @@ public function getData() public function create() { - $slide = null; - $page_title = 'Slide'; + $slide = null; + $page_title = 'Slide'; $page_description = 'Tambah Slide'; return view('setting.slide.create', compact('page_title', 'page_description', 'slide')); @@ -75,16 +75,17 @@ public function store(SlideRequest $request) $input = $request->validated(); if ($request->hasFile('gambar')) { - $file = $request->file('gambar'); + $file = $request->file('gambar'); $fileName = $file->getClientOriginalName(); - $path = "storage/slide/"; + $path = 'storage/slide/'; $file->move($path, $fileName); - $input['gambar'] = $path . $fileName; + $input['gambar'] = $path.$fileName; } Slide::create($input); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Slide gagal ditambah!'); } @@ -93,15 +94,15 @@ public function store(SlideRequest $request) public function show(Slide $slide) { - $page_title = 'Detail Slide :' . $slide->judul; + $page_title = 'Detail Slide :'.$slide->judul; return view('setting.slide.show', compact('page_title', 'page_description', 'slide')); } public function edit(Slide $slide) { - $page_title = 'Slide'; - $page_description = 'Ubah Slide : ' . $slide->judul; + $page_title = 'Slide'; + $page_description = 'Ubah Slide : '.$slide->judul; return view('setting.slide.edit', compact('page_title', 'page_description', 'slide')); } @@ -112,17 +113,18 @@ public function update(SlideRequest $request, Slide $slide) $input = $request->validated(); if ($request->hasFile('gambar')) { - $file = $request->file('gambar'); + $file = $request->file('gambar'); $fileName = $file->getClientOriginalName(); - $path = "storage/slide/"; + $path = 'storage/slide/'; $file->move($path, $fileName); - unlink(base_path('public/' . $slide->gambar)); + unlink(base_path('public/'.$slide->gambar)); - $input['gambar'] = $path . $fileName; + $input['gambar'] = $path.$fileName; } $slide->update($input); } catch (\Exception $e) { report($e); + return back()->with('error', 'Data Slide gagal disimpan!'); } @@ -133,10 +135,11 @@ public function destroy(Slide $slide) { try { if ($slide->delete()) { - unlink(base_path('public/' . $slide->gambar)); + unlink(base_path('public/'.$slide->gambar)); } } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Slide gagal dihapus!'); } diff --git a/app/Http/Controllers/Setting/TipePotensiController.php b/app/Http/Controllers/Setting/TipePotensiController.php index 03d01d630..45b1c87b7 100644 --- a/app/Http/Controllers/Setting/TipePotensiController.php +++ b/app/Http/Controllers/Setting/TipePotensiController.php @@ -46,8 +46,8 @@ class TipePotensiController extends Controller */ public function index() { - $page_title = 'Kategori Potensi'; - $page_description = 'Daftar ' . 'Kategori Potensi'; + $page_title = 'Kategori Potensi'; + $page_description = 'Daftar '.'Kategori Potensi'; return view('setting.tipe_potensi.index', compact('page_title', 'page_description')); } @@ -57,7 +57,7 @@ public function getData() { return DataTables::of(TipePotensi::all()) ->addColumn('aksi', function ($row) { - $data['edit_url'] = route('setting.tipe-potensi.edit', $row->id); + $data['edit_url'] = route('setting.tipe-potensi.edit', $row->id); $data['delete_url'] = route('setting.tipe-potensi.destroy', $row->id); return view('forms.aksi', $data); @@ -72,7 +72,7 @@ public function getData() */ public function create() { - $page_title = 'Kategori Potensi'; + $page_title = 'Kategori Potensi'; $page_description = 'Tambah Kategori Potensi'; return view('setting.tipe_potensi.create', compact('page_title', 'page_description')); @@ -90,10 +90,11 @@ public function store(Request $request) ]); try { - $tipe = new TipePotensi($request->all()); + $tipe = new TipePotensi($request->all()); $tipe->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Tipe Potensi gagal dikirim!'); } @@ -108,9 +109,9 @@ public function store(Request $request) */ public function edit($id) { - $tipe = TipePotensi::findOrFail($id); - $page_title = 'Kategori Potensi'; - $page_description = 'Ubah Kategori Potensi : ' . $tipe->nama_kategori; + $tipe = TipePotensi::findOrFail($id); + $page_title = 'Kategori Potensi'; + $page_description = 'Ubah Kategori Potensi : '.$tipe->nama_kategori; return view('setting.tipe_potensi.edit', compact('page_title', 'page_description', 'tipe')); } @@ -133,6 +134,7 @@ public function update(Request $request, $id) $tipe->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Kategori Potensi gagal diupdate!'); } @@ -151,6 +153,7 @@ public function destroy($id) TipePotensi::findOrFail($id)->delete(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Tipe Potensi gagal dihapus!'); } diff --git a/app/Http/Controllers/Setting/TipeRegulasiController.php b/app/Http/Controllers/Setting/TipeRegulasiController.php index 7580cb3e6..d7eea790a 100644 --- a/app/Http/Controllers/Setting/TipeRegulasiController.php +++ b/app/Http/Controllers/Setting/TipeRegulasiController.php @@ -40,7 +40,7 @@ class TipeRegulasiController extends Controller { public function index() { - $page_title = 'Tipe Regulasi'; + $page_title = 'Tipe Regulasi'; $page_description = 'Daftar TIpe Regulasi'; return view('setting.tipe_regulasi.index', compact('page_title', 'page_description')); @@ -51,7 +51,7 @@ public function getData() { return DataTables::of(TipeRegulasi::all()) ->addColumn('aksi', function ($row) { - $data['edit_url'] = route('setting.tipe-regulasi.edit', $row->id); + $data['edit_url'] = route('setting.tipe-regulasi.edit', $row->id); $data['delete_url'] = route('setting.tipe-regulasi.destroy', $row->id); return view('forms.aksi', $data); @@ -62,7 +62,7 @@ public function getData() // Create Action public function create() { - $page_title = 'Tipe Regulasi'; + $page_title = 'Tipe Regulasi'; $page_description = 'Tambah Tipe Regulasi'; return view('setting.tipe_regulasi.create', compact('page_title', 'page_description')); @@ -76,10 +76,11 @@ public function store(Request $request) ]); try { - $tipe = new TipeRegulasi($request->all()); + $tipe = new TipeRegulasi($request->all()); $tipe->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Tipe Regulasi gagal dikirim!'); } @@ -88,9 +89,9 @@ public function store(Request $request) public function edit($id) { - $tipe = TipeRegulasi::findOrFail($id); - $page_title = 'Tipe Regulasi'; - $page_description = 'Ubah Tipe Regulasi : ' . $tipe->nama; + $tipe = TipeRegulasi::findOrFail($id); + $page_title = 'Tipe Regulasi'; + $page_description = 'Ubah Tipe Regulasi : '.$tipe->nama; return view('setting.tipe_regulasi.edit', compact('page_title', 'page_description', 'tipe')); } @@ -107,6 +108,7 @@ public function update(Request $request, $id) $tipe->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Tipe Regulasi gagal diupdate!'); } @@ -119,6 +121,7 @@ public function destroy($id) TipeRegulasi::findOrFail($id)->delete(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Tipe Regulasi gagal dihapus!'); } diff --git a/app/Http/Controllers/SistemKomplain/SistemKomplainController.php b/app/Http/Controllers/SistemKomplain/SistemKomplainController.php index b8bc49800..f05c251f0 100644 --- a/app/Http/Controllers/SistemKomplain/SistemKomplainController.php +++ b/app/Http/Controllers/SistemKomplain/SistemKomplainController.php @@ -43,7 +43,7 @@ class SistemKomplainController extends Controller { public function index() { - $page_title = 'SIKEMA'; + $page_title = 'SIKEMA'; $page_description = 'Sistem Keluhan Masyarakat'; $komplains = Komplain::with('kategori_komplain') @@ -57,7 +57,7 @@ public function index() // TODO : Cek digunakan dimana ? public function indexKategori($slug) { - $page_title = 'SIKEMA'; + $page_title = 'SIKEMA'; $page_description = 'Sistem Keluhan Masyarakat'; $komplains = Komplain::where('kategori', '=', $slug)->orderBy('created_at', 'desc')->paginate(10); @@ -67,7 +67,7 @@ public function indexKategori($slug) // TODO : Cek digunakan dimana ? public function indexSukses() { - $page_title = 'SIKEMA'; + $page_title = 'SIKEMA'; $page_description = 'Sistem Keluhan Masyarakat'; $komplains = Komplain::where('status', '=', 'Selesai')->orderBy('created_at', 'desc')->paginate(10); @@ -76,7 +76,7 @@ public function indexSukses() public function kirim() { - $page_title = 'Kirim Keluhan'; + $page_title = 'Kirim Keluhan'; $page_description = 'Kirim Keluhan Baru'; return view('sistem_komplain.komplain.kirim', compact('page_title', 'page_description')); @@ -86,19 +86,21 @@ public function tracking(Request $request) { try { $komplain = Komplain::where('komplain_id', '=', $request->post('q'))->firstOrFail(); + return redirect()->route('sistem-komplain.komplain', $komplain->slug); } catch (\Exception $e) { report($e); + return back()->with('warning', 'Komplain tidak ditemukan!'); } } protected function generateID() { - $id = mt_rand(100000, 999999); + $id = mt_rand(100000, 999999); $pid = ''; - if (!Komplain::where('komplain_id', '=', $id)->exists()) { + if (! Komplain::where('komplain_id', '=', $id)->exists()) { $pid = $id; } else { $this->generateID(); @@ -111,19 +113,19 @@ public function store(Request $request) { try { $validator = Validator::make($request->all(), [ - 'nik' => 'required|numeric|nik_exists:' . $request->input('tanggal_lahir'), - 'judul' => 'required|string|max:255', - 'kategori' => 'required', - 'laporan' => 'required|string', - 'captcha' => 'required|captcha', - 'tanggal_lahir' => 'password_exists:' . $request->input('nik'), - 'lampiran1' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', - 'lampiran2' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', - 'lampiran3' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', - 'lampiran4' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', + 'nik' => 'required|numeric|nik_exists:'.$request->input('tanggal_lahir'), + 'judul' => 'required|string|max:255', + 'kategori' => 'required', + 'laporan' => 'required|string', + 'captcha' => 'required|captcha', + 'tanggal_lahir' => 'password_exists:'.$request->input('nik'), + 'lampiran1' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', + 'lampiran2' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', + 'lampiran3' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', + 'lampiran4' => 'file|mimes:jpeg,png,jpg,gif,svg|max:1024|valid_file', ], [ 'captcha.captcha' => 'Invalid captcha code.', - 'nik_exists' => 'NIK tidak ditemukan atau NIK dan Tanggal Lahir tidak sesuai.', + 'nik_exists' => 'NIK tidak ditemukan atau NIK dan Tanggal Lahir tidak sesuai.', 'password_exists' => 'NIK dan Tanggal Lahir tidak sesuai.', ]); @@ -133,47 +135,48 @@ public function store(Request $request) $komplain = new Komplain($request->all()); $komplain->komplain_id = $this->generateID(); - $komplain->slug = str_slug($komplain->judul) . '-' . $komplain->komplain_id; - $komplain->status = 'REVIEW'; - $komplain->dilihat = 0; - $komplain->nama = Penduduk::where('nik', $komplain->nik)->first()->nama; + $komplain->slug = str_slug($komplain->judul).'-'.$komplain->komplain_id; + $komplain->status = 'REVIEW'; + $komplain->dilihat = 0; + $komplain->nama = Penduduk::where('nik', $komplain->nik)->first()->nama; // Save if lampiran available if ($request->hasFile('lampiran1')) { $lampiran1 = $request->file('lampiran1'); $fileName1 = $lampiran1->getClientOriginalName(); - $path = "storage/komplain/" . $komplain->komplain_id . '/'; + $path = 'storage/komplain/'.$komplain->komplain_id.'/'; $request->file('lampiran1')->move($path, $fileName1); - $komplain->lampiran1 = $path . $fileName1; + $komplain->lampiran1 = $path.$fileName1; } if ($request->hasFile('lampiran2')) { $lampiran2 = $request->file('lampiran2'); $fileName2 = $lampiran2->getClientOriginalName(); - $path = "storage/komplain/" . $komplain->komplain_id . '/'; + $path = 'storage/komplain/'.$komplain->komplain_id.'/'; $request->file('lampiran2')->move($path, $fileName2); - $komplain->lampiran2 = $path . $fileName2; + $komplain->lampiran2 = $path.$fileName2; } if ($request->hasFile('lampiran3')) { $lampiran3 = $request->file('lampiran3'); $fileName3 = $lampiran3->getClientOriginalName(); - $path = "storage/komplain/" . $komplain->komplain_id . '/'; + $path = 'storage/komplain/'.$komplain->komplain_id.'/'; $request->file('lampiran3')->move($path, $fileName3); - $komplain->lampiran3 = $path . $fileName3; + $komplain->lampiran3 = $path.$fileName3; } if ($request->hasFile('lampiran4')) { $lampiran4 = $request->file('lampiran4'); $fileName4 = $lampiran4->getClientOriginalName(); - $path = "storage/komplain/" . $komplain->komplain_id . '/'; + $path = 'storage/komplain/'.$komplain->komplain_id.'/'; $request->file('lampiran3')->move($path, $fileName4); - $komplain->lampiran4 = $path . $fileName4; + $komplain->lampiran4 = $path.$fileName4; } $komplain->save(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Komplain gagal dikirim!'); } @@ -192,11 +195,12 @@ public function show($slug) $komplain = Komplain::where('slug', '=', $slug)->first(); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', $e); } - $page_title = 'Laporan'; - $page_description = 'Detail Laporan : ' . $komplain->judul; + $page_title = 'Laporan'; + $page_description = 'Detail Laporan : '.$komplain->judul; return view('sistem_komplain.komplain.show', compact('page_title', 'page_description', 'komplain')); } @@ -216,11 +220,11 @@ public function reply(Request $request, $id) $jawab->penjawab = 'Admin'; } else { request()->validate([ - 'jawaban' => 'required', - 'nik' => 'required|numeric|nik_exists:' . $request->input('tanggal_lahir'), - 'tanggal_lahir' => 'password_exists:' . $request->input('nik'), + 'jawaban' => 'required', + 'nik' => 'required|numeric|nik_exists:'.$request->input('tanggal_lahir'), + 'tanggal_lahir' => 'password_exists:'.$request->input('nik'), ], [ - 'nik_exists' => 'NIK tidak ditemukan atau NIK dan Tanggal Lahir tidak sesuai.', + 'nik_exists' => 'NIK tidak ditemukan atau NIK dan Tanggal Lahir tidak sesuai.', 'password_exists' => 'NIK dan Tanggal Lahir tidak sesuai.', ]); @@ -233,15 +237,17 @@ public function reply(Request $request, $id) $jawab->save(); $response = [ 'status' => 'success', - 'msg' => 'Jawaban berhasil disimpan!', + 'msg' => 'Jawaban berhasil disimpan!', ]; + return response()->json($response); } catch (\Exception $e) { report($e); $response = [ 'status' => 'error', - 'msg' => 'Jawaban gagal disimpan!', + 'msg' => 'Jawaban gagal disimpan!', ]; + return response()->json($response); } } else { diff --git a/app/Http/Controllers/SitemapController.php b/app/Http/Controllers/SitemapController.php index 5c17acd25..967b72a43 100644 --- a/app/Http/Controllers/SitemapController.php +++ b/app/Http/Controllers/SitemapController.php @@ -40,22 +40,23 @@ class SitemapController extends Controller { public function index() { - $profil = Profil::orderBy('updated_at', 'DESC')->first(); + $profil = Profil::orderBy('updated_at', 'DESC')->first(); $prosedur = Prosedur::orderBy('updated_at', 'DESC')->first(); $regulasi = Regulasi::orderBy('updated_at', 'DESC')->first(); - $dokumen = FormDokumen::orderBy('updated_at', 'DESC')->first(); + $dokumen = FormDokumen::orderBy('updated_at', 'DESC')->first(); return response()->view('sitemap.index', [ - 'profil' => $profil, + 'profil' => $profil, 'prosedur' => $prosedur, 'regulasi' => $regulasi, - 'dokumen' => $dokumen, + 'dokumen' => $dokumen, ])->header('Content-Type', 'text/xml'); } public function prosedur() { $prosedurs = Prosedur::all(); + return response()->view('sitemap.prosedur', [ 'prosedurs' => $prosedurs, ])->header('Content-Type', 'text/xml'); diff --git a/app/Http/Controllers/Surat/PermohonanController.php b/app/Http/Controllers/Surat/PermohonanController.php index 27e4f9937..5f9447491 100644 --- a/app/Http/Controllers/Surat/PermohonanController.php +++ b/app/Http/Controllers/Surat/PermohonanController.php @@ -48,7 +48,7 @@ class PermohonanController extends Controller { public function index() { - $page_title = 'Permohonan Surat'; + $page_title = 'Permohonan Surat'; $page_description = 'Daftar Permohonan Surat'; return view('surat.permohonan.index', compact('page_title', 'page_description')); @@ -102,8 +102,8 @@ public function getData() public function show($id) { - $surat = Surat::findOrFail($id); - $page_title = 'Detail Surat'; + $surat = Surat::findOrFail($id); + $page_title = 'Detail Surat'; $page_description = "Detail Data Surat: {$surat->nama}"; // Cek pemeriksa @@ -119,7 +119,7 @@ public function show($id) $isAllow = true; } - if (!$isAllow) { + if (! $isAllow) { return back()->with('error', 'Anda tidak memiliki akses'); } @@ -131,9 +131,10 @@ public function download($id) try { $surat = Surat::findOrFail($id); - return Storage::download('public/surat/' . $surat->file); + return Storage::download('public/surat/'.$surat->file); } catch (\Exception $e) { report($e); + return back()->with('error', 'Dokumen tidak ditemukan'); } } @@ -141,7 +142,7 @@ public function download($id) public function setujui($id) { try { - $surat = Surat::findOrFail($id); + $surat = Surat::findOrFail($id); $log_sekarang = $surat->log_verifikasi; if ($log_sekarang == LogVerifikasiSurat::Operator) { @@ -160,6 +161,7 @@ public function setujui($id) } catch (\Exception $e) { report($e); } + return response()->json(); } @@ -168,12 +170,13 @@ public function tolak(Request $request, $id) try { Surat::findOrFail($id)->update([ 'log_verifikasi' => LogVerifikasiSurat::Ditolak, - 'status' => StatusSurat::Ditolak, - 'keterangan' => $request['keterangan'], + 'status' => StatusSurat::Ditolak, + 'keterangan' => $request['keterangan'], ]); } catch (\Exception $e) { report($e); } + return response()->json(); } @@ -185,7 +188,7 @@ public function passphrase(Request $request, $id) $client = new \GuzzleHttp\Client([ 'base_uri' => $this->settings['tte_api'], - 'auth' => [ + 'auth' => [ $this->settings['tte_username'], $this->settings['tte_password'], ], @@ -193,12 +196,12 @@ public function passphrase(Request $request, $id) try { $file_path = public_path("storage/surat/{$surat->file}"); - $width = 90; - $height = 90; - $tag = '[qr_camat]'; + $width = 90; + $height = 90; + $tag = '[qr_camat]'; $response = $client->post('api/sign/pdf', [ - 'headers' => ['X-Requested-With' => 'XMLHttpRequest'], + 'headers' => ['X-Requested-With' => 'XMLHttpRequest'], 'multipart' => [ ['name' => 'file', 'contents' => Psr7\Utils::tryFopen($file_path, 'r')], ['name' => 'nik', 'contents' => $surat->pengurus->nik], @@ -213,7 +216,7 @@ public function passphrase(Request $request, $id) $surat->update([ 'status' => StatusSurat::Arsip, - 'log_verifikasi' => LogVerifikasiSurat::SudahTTE + 'log_verifikasi' => LogVerifikasiSurat::SudahTTE, ]); DB::commit(); @@ -226,9 +229,9 @@ public function passphrase(Request $request, $id) } return $this->response([ - 'status' => true, + 'status' => true, 'pesan_error' => 'success', - 'jenis' => 'success', + 'jenis' => 'success', ]); } catch (ClientException $e) { report($e); @@ -236,9 +239,9 @@ public function passphrase(Request $request, $id) DB::rollback(); return $this->response([ - 'status' => false, + 'status' => false, 'pesan_error' => $e->getMessage(), - 'jenis' => 'ClientException', + 'jenis' => 'ClientException', ]); } } @@ -247,7 +250,7 @@ protected function response($notif = []) { LogTte::create([ 'pesan_error' => $notif['pesan_error'], - 'jenis' => $notif['jenis'], + 'jenis' => $notif['jenis'], ]); return response()->json($notif); @@ -255,7 +258,7 @@ protected function response($notif = []) public function ditolak() { - $page_title = 'Permohonan Surat Ditolak'; + $page_title = 'Permohonan Surat Ditolak'; $page_description = 'Daftar Permohonan Surat Ditolak'; return view('surat.permohonan.ditolak', compact('page_title', 'page_description')); diff --git a/app/Http/Controllers/Surat/SuratController.php b/app/Http/Controllers/Surat/SuratController.php index f823ebfdd..d0e14a4f3 100644 --- a/app/Http/Controllers/Surat/SuratController.php +++ b/app/Http/Controllers/Surat/SuratController.php @@ -44,7 +44,7 @@ class SuratController extends Controller { public function arsip() { - $page_title = 'Arsip Surat'; + $page_title = 'Arsip Surat'; $page_description = 'Daftar Arsip Surat'; return view('surat.arsip', compact('page_title', 'page_description')); @@ -54,7 +54,7 @@ public function getData() { return DataTables::of(Surat::arsip()) ->addColumn('aksi', function ($row) { - $data['download_url'] = route('surat.arsip.download', $row->id); + $data['download_url'] = route('surat.arsip.download', $row->id); return view('forms.aksi', $data); }) @@ -69,21 +69,22 @@ public function download($id) try { $surat = Surat::findOrFail($id); - return Storage::download('public/surat/' . $surat->file); + return Storage::download('public/surat/'.$surat->file); } catch (\Exception $e) { report($e); + return back()->with('error', 'Dokumen tidak ditemukan'); } } public function pengaturan() { - $formAction = route('surat.pengaturan.update'); - $camat = $this->akun_camat; - $sekretaris = $this->akun_sekretaris; - $profil = Profil::first(); - $page_title = 'Pegaturan Surat'; - $page_description = 'Daftar Pegaturan Surat'; + $formAction = route('surat.pengaturan.update'); + $camat = $this->akun_camat; + $sekretaris = $this->akun_sekretaris; + $profil = Profil::first(); + $page_title = 'Pegaturan Surat'; + $page_description = 'Daftar Pegaturan Surat'; return view('surat.pengaturan', compact('page_title', 'page_description', 'formAction', 'camat', 'sekretaris')); } @@ -96,6 +97,7 @@ public function pengaturan_update(PengaturanSuratRequest $request) } } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', 'Pengaturan Surat gagal diubah!'); } @@ -104,7 +106,7 @@ public function pengaturan_update(PengaturanSuratRequest $request) public function qrcode($id) { - $surat = Surat::where('id', '=', $id)->where('status', '=', StatusSurat::Arsip)->firstOrFail(); + $surat = Surat::where('id', '=', $id)->where('status', '=', StatusSurat::Arsip)->firstOrFail(); $profil = Profil::first(); return view('surat.qrcode', compact('surat', 'profil')); diff --git a/app/Http/Controllers/User/UserController.php b/app/Http/Controllers/User/UserController.php index 03439ef0e..3376bfc0e 100644 --- a/app/Http/Controllers/User/UserController.php +++ b/app/Http/Controllers/User/UserController.php @@ -50,7 +50,7 @@ class UserController extends Controller */ public function index() { - $page_title = 'Pengguna'; + $page_title = 'Pengguna'; $page_description = 'Daftar Data'; return view('user.index', compact('page_title', 'page_description')); @@ -63,10 +63,10 @@ public function index() */ public function create() { - $page_title = 'Pengguna'; + $page_title = 'Pengguna'; $page_description = 'Tambah Data'; - $item = Role::where('name', '!=', 'super-admin')->pluck('name', 'name')->toArray(); - $pengurus = Pengurus::status()->doesntHave('user')->get(); + $item = Role::where('name', '!=', 'super-admin')->pluck('name', 'name')->toArray(); + $pengurus = Pengurus::status()->doesntHave('user')->get(); return view('user.create', compact('page_title', 'page_description', 'item', 'pengurus')); } @@ -74,13 +74,13 @@ public function create() /** * Store a newly created resource in storage. * - * @param Request $request + * @param Request $request * @return Response */ public function store(UserRequest $request) { try { - $status = !empty($request->status) ? 1 : 1; + $status = ! empty($request->status) ? 1 : 1; $request->merge(['status' => $status]); $user = User::create($request->validated()); if ($request->hasFile('image')) { @@ -93,6 +93,7 @@ public function store(UserRequest $request) return redirect()->route('setting.user.index')->with('success', 'User berhasil ditambahkan!'); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', $e->getMessage()); } } @@ -106,6 +107,7 @@ public function store(UserRequest $request) public function show($id) { $user = User::findOrFail($id); + return view('user.show', compact('user')); } @@ -117,11 +119,11 @@ public function show($id) */ public function edit($id) { - $page_title = 'Pengguna'; + $page_title = 'Pengguna'; $page_description = 'Ubah Data'; - $user = User::findOrFail($id); - $item = Role::where('name', '!=', 'super-admin')->pluck('name', 'name')->toArray(); - $pengurus = Pengurus::status()->doesntHave('user')->orWhere('id', $user->pengurus_id)->get(); + $user = User::findOrFail($id); + $item = Role::where('name', '!=', 'super-admin')->pluck('name', 'name')->toArray(); + $pengurus = Pengurus::status()->doesntHave('user')->orWhere('id', $user->pengurus_id)->get(); return view('user.edit', compact('page_title', 'page_description', 'user', 'item', 'pengurus')); } @@ -129,7 +131,7 @@ public function edit($id) /** * Update the specified resource in storage. * - * @param Request $request + * @param Request $request * @param int $id * @return Response */ @@ -143,7 +145,7 @@ public function update(UserRequest $request, $id) $user->uploadImage($request->image); } - if (!empty($request->role)) { + if (! empty($request->role)) { $roles = $request->input('role') ? $request->input('role') : []; $user->syncRoles($roles); } @@ -151,6 +153,7 @@ public function update(UserRequest $request, $id) return redirect()->route('setting.user.index')->with('success', 'User berhasil diperbarui!'); } catch (\Exception $e) { report($e); + return back()->withInput()->with('error', $e->getMessage()); } } @@ -158,7 +161,7 @@ public function update(UserRequest $request, $id) /** * Update the specified resource in storage. * - * @param Request $request + * @param Request $request * @param int $id * @return Response */ @@ -173,10 +176,12 @@ public function updatePassword(UserUpdateRequest $request, $id) ]); flash()->success(trans('message.user.update-success')); + return redirect()->route('setting.user.index'); } catch (\Exception $e) { report($e); flash()->error(trans('message.user.update-error')); + return back()->withInput(); } } @@ -190,15 +195,17 @@ public function updatePassword(UserUpdateRequest $request, $id) public function destroy($id) { try { - $user = User::findOrFail($id); + $user = User::findOrFail($id); $user->status = 0; $user->save(); flash()->success(trans('general.suspend-success')); + return redirect()->route('setting.user.index'); } catch (\Exception $e) { report($e); flash()->success(trans('general.suspend-error')); + return redirect()->route('setting.user.index'); } } @@ -212,15 +219,17 @@ public function destroy($id) public function active($id) { try { - $user = User::findOrFail($id); + $user = User::findOrFail($id); $user->status = 1; $user->save(); flash()->success(trans('general.active-success')); + return redirect()->route('setting.user.index'); } catch (\Exception $e) { report($e); flash()->success(trans('general.active-error')); + return redirect()->route('setting.user.index'); } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index fee9a09fe..3181fa323 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -99,7 +99,7 @@ class Kernel extends HttpKernel 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, - 'xss_sanitization' => \App\Http\Middleware\XssSanitization::class, + 'xss_sanitization' => \App\Http\Middleware\XssSanitization::class, 'complete_profile' => \App\Http\Middleware\CompleteProfile::class, ]; diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index ab652fb69..ec973ae1f 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -38,12 +38,12 @@ class Authenticate extends Middleware /** * Get the path the user should be redirected to when they are not authenticated. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * @return string|null */ protected function redirectTo($request) { - if (!$request->expectsJson()) { + if (! $request->expectsJson()) { return route('login'); } } diff --git a/app/Http/Middleware/CompleteProfile.php b/app/Http/Middleware/CompleteProfile.php index 730dec358..c68345849 100644 --- a/app/Http/Middleware/CompleteProfile.php +++ b/app/Http/Middleware/CompleteProfile.php @@ -40,12 +40,11 @@ class CompleteProfile * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { - if (!Profil::first()->kecamatan_id) { + if (! Profil::first()->kecamatan_id) { return redirect()->route('data.profil.index'); } diff --git a/app/Http/Middleware/CustomForms.php b/app/Http/Middleware/CustomForms.php index d51687af7..f161ac274 100644 --- a/app/Http/Middleware/CustomForms.php +++ b/app/Http/Middleware/CustomForms.php @@ -32,12 +32,9 @@ namespace App\Http\Middleware; use function array_diff_key; - use Closure; use Form; - use Illuminate\Http\Request; - use function session; use function sprintf; @@ -46,7 +43,7 @@ class CustomForms /** * Handle an incoming request. * - * @param Request $request + * @param Request $request * @return mixed */ public function handle($request, Closure $next) @@ -58,7 +55,7 @@ public function handle($request, Closure $next) // with configured default options... Form::macro('modelHorizontal', function ($model, $options = []) { $options = array_diff_key([ - 'class' => 'form-horizontal', + 'class' => 'form-horizontal', 'autocomplete' => 'off', ], $options) + $options; @@ -70,8 +67,6 @@ public function handle($request, Closure $next) if ($errors && $errors->has($field)) { return ' has-error'; } - - return; }); // Generate error message if the given field has errors... @@ -79,8 +74,6 @@ public function handle($request, Closure $next) if ($errors && $errors->has($field)) { return sprintf('
%s
', $errors->first($field)); } - - return; }); return $next($request); diff --git a/app/Http/Middleware/KDInstalled.php b/app/Http/Middleware/KDInstalled.php index 1b1614ffb..06c937560 100644 --- a/app/Http/Middleware/KDInstalled.php +++ b/app/Http/Middleware/KDInstalled.php @@ -32,9 +32,7 @@ namespace App\Http\Middleware; use Closure; - use Illuminate\Http\Request; - use function redirect; class KDInstalled @@ -42,14 +40,15 @@ class KDInstalled /** * Handle an incoming request. * - * @param Request $request + * @param Request $request * @return mixed */ public function handle($request, Closure $next) { - if (!sudahInstal()) { + if (! sudahInstal()) { return redirect()->to('install'); } + return $next($request); } } diff --git a/app/Http/Middleware/MaintenanceMode.php b/app/Http/Middleware/MaintenanceMode.php index b502e6248..a793e13b2 100644 --- a/app/Http/Middleware/MaintenanceMode.php +++ b/app/Http/Middleware/MaintenanceMode.php @@ -40,7 +40,6 @@ class MaintenanceMode * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 7eabc0ef4..35457cdbc 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -41,7 +41,6 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param Request $request * @param \Closure(Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param string|null ...$guards * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse diff --git a/app/Http/Middleware/SecurityHeaders.php b/app/Http/Middleware/SecurityHeaders.php index ec14b5830..b88e70e06 100644 --- a/app/Http/Middleware/SecurityHeaders.php +++ b/app/Http/Middleware/SecurityHeaders.php @@ -36,13 +36,13 @@ class SecurityHeaders { protected $unwantedHeaders = ['X-Powered-By', 'server', 'Server']; + /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ public function handle($request, Closure $next) { /** @var \Illuminate\Http\Response $response */ diff --git a/app/Http/Middleware/XssSanitization.php b/app/Http/Middleware/XssSanitization.php index 8c7c0b142..943d971be 100644 --- a/app/Http/Middleware/XssSanitization.php +++ b/app/Http/Middleware/XssSanitization.php @@ -39,7 +39,6 @@ class XssSanitization * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Requests/AnggaranDesaRequest.php b/app/Http/Requests/AnggaranDesaRequest.php index f582f64a7..c4d407da1 100644 --- a/app/Http/Requests/AnggaranDesaRequest.php +++ b/app/Http/Requests/AnggaranDesaRequest.php @@ -53,8 +53,8 @@ public function authorize() public function rules() { return [ - 'desa' => 'required', - 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120', + 'desa' => 'required', + 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120', 'bulan' => 'required', 'tahun' => 'required', ]; diff --git a/app/Http/Requests/ArtikelRequest.php b/app/Http/Requests/ArtikelRequest.php index 56cf01feb..177d05e9c 100644 --- a/app/Http/Requests/ArtikelRequest.php +++ b/app/Http/Requests/ArtikelRequest.php @@ -53,10 +53,10 @@ public function authorize() public function rules() { return [ - 'judul' => 'required|string|max:191', - 'isi' => 'required', - 'status' => 'required', - 'gambar' => 'nullable|image|mimes:jpg,jpeg,png|max:1024|valid_file', + 'judul' => 'required|string|max:191', + 'isi' => 'required', + 'status' => 'required', + 'gambar' => 'nullable|image|mimes:jpg,jpeg,png|max:1024|valid_file', ]; } } diff --git a/resources/lang/de/installer_messages.php b/app/Http/Requests/DataUmumRequest.php similarity index 50% rename from resources/lang/de/installer_messages.php rename to app/Http/Requests/DataUmumRequest.php index b8e875df3..02a58246a 100644 --- a/resources/lang/de/installer_messages.php +++ b/app/Http/Requests/DataUmumRequest.php @@ -29,65 +29,53 @@ * @link https://github.com/OpenSID/opendk */ -return [ +namespace App\Http\Requests; - /** - * - * Shared translations. - * - */ - 'title' => 'Laravel Installer', - 'next' => 'Nächster Schritt', - 'finish' => 'Installieren', +use Illuminate\Foundation\Http\FormRequest; +class DataUmumRequest extends FormRequest +{ /** + * Determine if the user is authorized to make this request. * - * Home page translations. - * + * @return bool */ - 'welcome' => [ - 'title' => 'Willkommen zum Installer', - 'message' => 'Willkommen zum Laravel Installationsassistent.', - ], + public function authorize() + { + return true; + } /** + * Get the validation rules that apply to the request. * - * Requirements page translations. - * - */ - 'requirements' => [ - 'title' => 'Vorraussetzungen', - ], - - /** - * - * Permissions page translations. - * - */ - 'permissions' => [ - 'title' => 'Berechtigungen', - ], - - /** - * - * Environment page translations. - * - */ - 'environment' => [ - 'title' => 'Umgebungsvariablen', - 'save' => 'Speicher .env', - 'success' => 'Ihre .env Konfiguration wurde gespeichert.', - 'errors' => 'Ihre .env Konfiguration konnte nicht gespeichert werden, Bitte erstellen Sie diese Manuell.', - ], - - /** - * - * Final page translations. - * + * @return array */ - 'final' => [ - 'title' => 'Fertig!', - 'finished' => 'Die Anwendung wurde erfolgreich Installiert.', - 'exit' => 'Hier Klicken zum Beenden', - ], -]; + public function rules() + { + return [ + 'tipologi' => 'required', + 'sejarah' => 'required', + 'sumber_luas_wilayah' => 'required', + 'luas_wilayah' => 'required', + 'bts_wil_utara' => 'required', + 'bts_wil_timur' => 'required', + 'bts_wil_selatan' => 'required', + 'bts_wil_barat' => 'required', + 'jml_puskesmas' => 'required', + 'jml_puskesmas_pembantu' => 'required', + 'jml_posyandu' => 'required', + 'jml_pondok_bersalin' => 'required', + 'jml_paud' => 'required', + 'jml_sd' => 'required', + 'jml_smp' => 'required', + 'jml_sma' => 'required', + 'jml_masjid_besar' => 'required', + 'jml_mushola' => 'required', + 'jml_gereja' => 'required', + 'jml_pasar' => 'required', + 'jml_balai_pertemuan' => 'required', + 'lat' => 'required', + 'lng' => 'required', + ]; + } +} diff --git a/app/Http/Requests/DesaRequest.php b/app/Http/Requests/DesaRequest.php index db51af833..3994aee96 100644 --- a/app/Http/Requests/DesaRequest.php +++ b/app/Http/Requests/DesaRequest.php @@ -54,15 +54,15 @@ public function authorize() public function rules() { if ($this->id) { - $id = "," . $this->id; + $id = ','.$this->id; } else { - $id = ""; + $id = ''; } return [ - 'desa_id' => ['required', 'regex:/^[0-9.]+$/', 'min:13', 'max:13', 'unique:das_data_desa,desa_id' . $id, new ValidDesa()], - 'nama' => 'required|string', - 'website' => 'nullable|url', + 'desa_id' => ['required', 'regex:/^[0-9.]+$/', 'min:13', 'max:13', 'unique:das_data_desa,desa_id'.$id, new ValidDesa()], + 'nama' => 'required|string', + 'website' => 'nullable|url', 'luas_wilayah' => 'required|numeric', ]; } diff --git a/app/Http/Requests/EventRequest.php b/app/Http/Requests/EventRequest.php index 2e4bd1a4f..4a41f6942 100644 --- a/app/Http/Requests/EventRequest.php +++ b/app/Http/Requests/EventRequest.php @@ -53,11 +53,11 @@ public function authorize() public function rules() { return [ - 'event_name' => 'required|string|max:150', - 'waktu' => 'required', - 'attendants' => 'required|string|max:250', + 'event_name' => 'required|string|max:150', + 'waktu' => 'required', + 'attendants' => 'required|string|max:250', 'description' => 'required', - 'attachment' => 'file|mimes:jpeg,png,jpg,gif,svg,xlsx,xls,doc,docx,pdf,ppt,pptx|max:2048', + 'attachment' => 'file|mimes:jpeg,png,jpg,gif,svg,xlsx,xls,doc,docx,pdf,ppt,pptx|max:2048', ]; } } diff --git a/app/Http/Requests/FaqRequest.php b/app/Http/Requests/FaqRequest.php index 94a6149d3..d1d4593cd 100644 --- a/app/Http/Requests/FaqRequest.php +++ b/app/Http/Requests/FaqRequest.php @@ -54,7 +54,7 @@ public function rules() { return [ 'question' => 'required|string|max:255', - 'answer' => 'required', + 'answer' => 'required', ]; } } diff --git a/app/Http/Requests/JabatanRequest.php b/app/Http/Requests/JabatanRequest.php index cf208f980..3c789fe94 100644 --- a/app/Http/Requests/JabatanRequest.php +++ b/app/Http/Requests/JabatanRequest.php @@ -53,7 +53,7 @@ public function authorize() public function rules() { return [ - 'nama' => 'required|regex:/^[a-zA-Z\s]*$/', + 'nama' => 'required|regex:/^[a-zA-Z\s]*$/', 'tupoksi' => 'nullable|string', ]; } diff --git a/app/Http/Requests/LaporanApbdesRequest.php b/app/Http/Requests/LaporanApbdesRequest.php index 5045aeffe..b58587b92 100644 --- a/app/Http/Requests/LaporanApbdesRequest.php +++ b/app/Http/Requests/LaporanApbdesRequest.php @@ -54,13 +54,13 @@ public function authorize() public function rules() { return [ - "desa_id" => ['required', 'string', new CekDesa()], - "laporan_apbdes.*.id" => "required|integer", - "laporan_apbdes.*.judul" => "required|string", - "laporan_apbdes.*.tahun" => "required|integer", - "laporan_apbdes.*.semester" => "required|integer", - "laporan_apbdes.*.nama_file" => "required|string", - "laporan_apbdes.*.file" => "required|string", + 'desa_id' => ['required', 'string', new CekDesa()], + 'laporan_apbdes.*.id' => 'required|integer', + 'laporan_apbdes.*.judul' => 'required|string', + 'laporan_apbdes.*.tahun' => 'required|integer', + 'laporan_apbdes.*.semester' => 'required|integer', + 'laporan_apbdes.*.nama_file' => 'required|string', + 'laporan_apbdes.*.file' => 'required|string', ]; } } diff --git a/app/Http/Requests/LaporanPendudukRequest.php b/app/Http/Requests/LaporanPendudukRequest.php index bdac5afd4..7982c59e6 100644 --- a/app/Http/Requests/LaporanPendudukRequest.php +++ b/app/Http/Requests/LaporanPendudukRequest.php @@ -54,12 +54,12 @@ public function authorize() public function rules() { return [ - "desa_id" => ['required', 'string', new CekDesa()], - "laporan_penduduk.*.id" => "required|integer", - "laporan_penduduk.*.judul" => "required|string", - "laporan_penduduk.*.bulan" => "required|integer", - "laporan_penduduk.*.tahun" => "required|integer", - "laporan_penduduk.*.file" => "required|string", + 'desa_id' => ['required', 'string', new CekDesa()], + 'laporan_penduduk.*.id' => 'required|integer', + 'laporan_penduduk.*.judul' => 'required|string', + 'laporan_penduduk.*.bulan' => 'required|integer', + 'laporan_penduduk.*.tahun' => 'required|integer', + 'laporan_penduduk.*.file' => 'required|string', ]; } } diff --git a/app/Http/Requests/MediaSosialRequest.php b/app/Http/Requests/MediaSosialRequest.php index e2eaf2e6f..2f8e4f82b 100644 --- a/app/Http/Requests/MediaSosialRequest.php +++ b/app/Http/Requests/MediaSosialRequest.php @@ -53,9 +53,9 @@ public function authorize() public function rules() { return [ - 'nama' => 'required|string|max:100', - 'url' => 'required|url', - 'logo' => 'file|mimes:jpg,jpeg,png|max:2048|valid_file', + 'nama' => 'required|string|max:100', + 'url' => 'required|url', + 'logo' => 'file|mimes:jpg,jpeg,png|max:2048|valid_file', 'status' => 'required', ]; } diff --git a/app/Http/Requests/PembangunanDokumentasiRequest.php b/app/Http/Requests/PembangunanDokumentasiRequest.php index abe34c6cd..87f022a52 100644 --- a/app/Http/Requests/PembangunanDokumentasiRequest.php +++ b/app/Http/Requests/PembangunanDokumentasiRequest.php @@ -55,7 +55,7 @@ public function rules() { return [ 'file' => 'file|mimes:zip|max:5120', - "desa_id" => ['required', 'string', new CekDesa()], + 'desa_id' => ['required', 'string', new CekDesa()], ]; } } diff --git a/app/Http/Requests/PembangunanRequest.php b/app/Http/Requests/PembangunanRequest.php index 7a87fbd6c..f136216de 100644 --- a/app/Http/Requests/PembangunanRequest.php +++ b/app/Http/Requests/PembangunanRequest.php @@ -55,7 +55,7 @@ public function rules() { return [ 'file' => 'file|mimes:zip|max:5120', - "desa_id" => ['required', 'string', new CekDesa()], + 'desa_id' => ['required', 'string', new CekDesa()], ]; } } diff --git a/app/Http/Requests/PendudukRequest.php b/app/Http/Requests/PendudukRequest.php index fad89b124..33c7f7284 100644 --- a/app/Http/Requests/PendudukRequest.php +++ b/app/Http/Requests/PendudukRequest.php @@ -54,9 +54,9 @@ public function rules() { return [ // Batch delete validation - "hapus_penduduk.*.id_pend_desa" => "present|integer", - "hapus_penduduk.*.foto" => "nullable", - "hapus_penduduk.*.desa_id" => "present|string|exists:das_data_desa,desa_id", + 'hapus_penduduk.*.id_pend_desa' => 'present|integer', + 'hapus_penduduk.*.foto' => 'nullable', + 'hapus_penduduk.*.desa_id' => 'present|string|exists:das_data_desa,desa_id', ]; } } diff --git a/app/Http/Requests/PengaturanSuratRequest.php b/app/Http/Requests/PengaturanSuratRequest.php index cc8aeb6c3..d6e6c8a37 100644 --- a/app/Http/Requests/PengaturanSuratRequest.php +++ b/app/Http/Requests/PengaturanSuratRequest.php @@ -53,7 +53,7 @@ public function authorize() public function rules() { return [ - 'tte_api' => 'sometimes|required|string', + 'tte_api' => 'sometimes|required|string', 'tte_username' => 'sometimes|required|string', 'tte_password' => 'sometimes|required|string', ]; diff --git a/app/Http/Requests/PengurusRequest.php b/app/Http/Requests/PengurusRequest.php index ee37d2f87..926166ca8 100644 --- a/app/Http/Requests/PengurusRequest.php +++ b/app/Http/Requests/PengurusRequest.php @@ -53,29 +53,29 @@ public function authorize() public function rules() { if ($this->isMethod('put')) { - $id = "," . $this->penguru; + $id = ','.$this->penguru; } else { - $id = ""; + $id = ''; } return [ - 'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:1024|valid_file', - 'nama' => "required|regex:/^[a-zA-Z '\.,\-]+$/|max:150", - 'gelar_depan' => "nullable|regex:/^[a-zA-Z '\.,\-]+$/|max:150", - 'gelar_belakang' => "nullable|regex:/^[a-zA-Z '\.,\-]+$/|max:150", - 'nik' => 'required|integer|digits:16|unique:das_pengurus,nik' . $id, - 'nip' => 'nullable|integer|digits:18|unique:das_pengurus,nip' . $id, - 'tempat_lahir' => "required|regex:/^[a-zA-Z0-9 '\.,\-\/]+$/", - 'tanggal_lahir' => "required|date", - 'jenis_kelamin' => 'integer', - 'pendidikan' => 'integer', - 'agama' => 'integer', - 'pangkat' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', - 'no_sk' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', - 'tanggal_sk' => 'nullable|date', - 'no_henti' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', - 'tanggal_henti' => 'nullable|date', - 'masa_jabatan' => 'required|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', + 'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:1024|valid_file', + 'nama' => "required|regex:/^[a-zA-Z '\.,\-]+$/|max:150", + 'gelar_depan' => "nullable|regex:/^[a-zA-Z '\.,\-]+$/|max:150", + 'gelar_belakang' => "nullable|regex:/^[a-zA-Z '\.,\-]+$/|max:150", + 'nik' => 'required|integer|digits:16|unique:das_pengurus,nik'.$id, + 'nip' => 'nullable|integer|digits:18|unique:das_pengurus,nip'.$id, + 'tempat_lahir' => "required|regex:/^[a-zA-Z0-9 '\.,\-\/]+$/", + 'tanggal_lahir' => 'required|date', + 'jenis_kelamin' => 'integer', + 'pendidikan' => 'integer', + 'agama' => 'integer', + 'pangkat' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', + 'no_sk' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', + 'tanggal_sk' => 'nullable|date', + 'no_henti' => 'nullable|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', + 'tanggal_henti' => 'nullable|date', + 'masa_jabatan' => 'required|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', ]; } } diff --git a/app/Http/Requests/PesanRequest.php b/app/Http/Requests/PesanRequest.php index 0a5883f7a..0fe33b598 100644 --- a/app/Http/Requests/PesanRequest.php +++ b/app/Http/Requests/PesanRequest.php @@ -56,14 +56,14 @@ public function rules() $rules = []; if (Request::has('pesan_id')) { - $rules['pesan'] = 'required'; - $rules['pesan_id'] = 'required|exists:das_pesan,id'; - $rules['pengirim'] = 'sometimes|required'; - $rules['nama_pengirim'] = 'sometimes|required'; + $rules['pesan'] = 'required'; + $rules['pesan_id'] = 'required|exists:das_pesan,id'; + $rules['pengirim'] = 'sometimes|required'; + $rules['nama_pengirim'] = 'sometimes|required'; } else { - $rules['pesan'] = 'required'; - $rules['judul'] = 'required'; - $rules['kode_desa'] = 'required|string|min:13|max:13'; + $rules['pesan'] = 'required'; + $rules['judul'] = 'required'; + $rules['kode_desa'] = 'required|string|min:13|max:13'; } return $rules; diff --git a/app/Http/Requests/PotensiRequest.php b/app/Http/Requests/PotensiRequest.php index 5adf5bc76..2aaab810a 100644 --- a/app/Http/Requests/PotensiRequest.php +++ b/app/Http/Requests/PotensiRequest.php @@ -53,11 +53,11 @@ public function authorize() public function rules() { return [ - 'kategori_id' => 'required', + 'kategori_id' => 'required', 'nama_potensi' => 'required|string|max:200', - 'deskripsi' => 'required|string', - 'lokasi' => 'required|string|max:200', - 'file_gambar' => 'file|mimes:bmp,jpg,jpeg,gif,png|max:1024|valid_file', + 'deskripsi' => 'required|string', + 'lokasi' => 'required|string|max:200', + 'file_gambar' => 'file|mimes:bmp,jpg,jpeg,gif,png|max:1024|valid_file', ]; } } diff --git a/app/Http/Requests/ProfilDesaRequest.php b/app/Http/Requests/ProfilDesaRequest.php index 0e2dd5fb2..4af248d38 100644 --- a/app/Http/Requests/ProfilDesaRequest.php +++ b/app/Http/Requests/ProfilDesaRequest.php @@ -53,10 +53,10 @@ public function authorize() public function rules() { return [ - "kode_desa" => "present|string|exists:das_data_desa,desa_id", - "sebutan_desa" => "required|string", - "website" => "sometimes|required|url", - "path" => "required|string" + 'kode_desa' => 'present|string|exists:das_data_desa,desa_id', + 'sebutan_desa' => 'required|string', + 'website' => 'sometimes|required|url', + 'path' => 'required|string', ]; } } diff --git a/app/Http/Requests/ProfilRequest.php b/app/Http/Requests/ProfilRequest.php index 6f103f8e2..913805851 100644 --- a/app/Http/Requests/ProfilRequest.php +++ b/app/Http/Requests/ProfilRequest.php @@ -53,20 +53,20 @@ public function authorize() public function rules() { return [ - 'provinsi_id' => 'required|string|min:2|max:2', - 'nama_provinsi' => 'required|string', - 'kabupaten_id' => 'required|string|min:5|max:5', - 'nama_kabupaten' => 'required|string', - 'kecamatan_id' => 'required|string|min:8|max:8', - 'nama_kecamatan' => 'required|string', - 'alamat' => "required|regex:/^[a-zA-Z0-9 '\.,\-\/]+$/", - 'kode_pos' => 'required|integer|digits_between:4,12', - 'telepon' => 'required|numeric|digits_between:5,14', - 'email' => 'required|email', - 'tahun_pembentukan' => 'required|integer', - 'dasar_pembentukan' => 'required|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', - 'file_logo' => 'image|mimes:jpg,jpeg,bmp,png,gif|max:1024|valid_file', - 'file_struktur_organisasi' => 'image|mimes:jpg,jpeg,png,bmp,gif|max:1024|valid_file', + 'provinsi_id' => 'required|string|min:2|max:2', + 'nama_provinsi' => 'required|string', + 'kabupaten_id' => 'required|string|min:5|max:5', + 'nama_kabupaten' => 'required|string', + 'kecamatan_id' => 'required|string|min:8|max:8', + 'nama_kecamatan' => 'required|string', + 'alamat' => "required|regex:/^[a-zA-Z0-9 '\.,\-\/]+$/", + 'kode_pos' => 'required|integer|digits_between:4,12', + 'telepon' => 'required|numeric|digits_between:5,14', + 'email' => 'required|email', + 'tahun_pembentukan' => 'required|integer', + 'dasar_pembentukan' => 'required|regex:/^[a-zA-Z0-9 \.\-\/]+$/|max:50', + 'file_logo' => 'image|mimes:jpg,jpeg,bmp,png,gif|max:1024|valid_file', + 'file_struktur_organisasi' => 'image|mimes:jpg,jpeg,png,bmp,gif|max:1024|valid_file', // 'visi' => 'required', // 'misi' => 'required', ]; diff --git a/app/Http/Requests/ProgramBantuanRequest.php b/app/Http/Requests/ProgramBantuanRequest.php index 5f6822d1e..17afe9e2e 100644 --- a/app/Http/Requests/ProgramBantuanRequest.php +++ b/app/Http/Requests/ProgramBantuanRequest.php @@ -55,7 +55,7 @@ public function rules() { return [ 'file' => 'file|mimes:zip|max:5120', - "desa_id" => ['required', 'string', new CekDesa()], + 'desa_id' => ['required', 'string', new CekDesa()], ]; } } diff --git a/app/Http/Requests/ProsedurRequest.php b/app/Http/Requests/ProsedurRequest.php index bc6c78daf..1a80e279a 100644 --- a/app/Http/Requests/ProsedurRequest.php +++ b/app/Http/Requests/ProsedurRequest.php @@ -54,7 +54,7 @@ public function rules() { return [ 'judul_prosedur' => 'required|string|min:5|max:150', - 'file_prosedur' => 'file|mimes:jpg,jpeg,png,gif,pdf|max:2048|valid_file', + 'file_prosedur' => 'file|mimes:jpg,jpeg,png,gif,pdf|max:2048|valid_file', ]; } } diff --git a/app/Http/Requests/RegulasiRequest.php b/app/Http/Requests/RegulasiRequest.php index a47f1cc21..7b40838db 100644 --- a/app/Http/Requests/RegulasiRequest.php +++ b/app/Http/Requests/RegulasiRequest.php @@ -54,8 +54,8 @@ public function rules() { return [ 'tipe_regulasi' => 'required', - 'judul' => 'required|string|max:200', - 'deskripsi' => 'required|string', + 'judul' => 'required|string|max:200', + 'deskripsi' => 'required|string', 'file_regulasi' => 'file|mimes:jpg,jpeg,png,gif,pdf|max:2048|valid_file', ]; } diff --git a/app/Http/Requests/SinergiProgramRequest.php b/app/Http/Requests/SinergiProgramRequest.php index be58d604d..9b44b9c13 100644 --- a/app/Http/Requests/SinergiProgramRequest.php +++ b/app/Http/Requests/SinergiProgramRequest.php @@ -55,9 +55,9 @@ public function rules() $gambarRule = $this->id ? 'nullable|' : 'required|'; return [ - 'nama' => 'required|string|max:100', - 'url' => 'required|url', - 'gambar' => $gambarRule . 'image|mimes:jpg,jpeg,png|max:2048|valid_file', + 'nama' => 'required|string|max:100', + 'url' => 'required|url', + 'gambar' => $gambarRule.'image|mimes:jpg,jpeg,png|max:2048|valid_file', 'status' => 'required|integer', ]; } diff --git a/app/Http/Requests/SlideRequest.php b/app/Http/Requests/SlideRequest.php index a58aeb32e..0fe78ddf4 100644 --- a/app/Http/Requests/SlideRequest.php +++ b/app/Http/Requests/SlideRequest.php @@ -53,9 +53,9 @@ public function authorize() public function rules() { return [ - 'judul' => 'required', + 'judul' => 'required', 'deskripsi' => 'required', - 'gambar' => 'file|mimes:jpg,jpeg,png|max:2048|valid_file', + 'gambar' => 'file|mimes:jpg,jpeg,png|max:2048|valid_file', ]; } } diff --git a/app/Http/Requests/TingkatPendidikanRequest.php b/app/Http/Requests/TingkatPendidikanRequest.php index 59177b86f..c84f53598 100644 --- a/app/Http/Requests/TingkatPendidikanRequest.php +++ b/app/Http/Requests/TingkatPendidikanRequest.php @@ -54,9 +54,9 @@ public function rules() { return [ 'desa_id' => 'required', - 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120', + 'file' => 'required|file|mimes:xls,xlsx,csv|max:5120', 'semester' => 'required', - 'tahun' => 'required', + 'tahun' => 'required', ]; } } diff --git a/app/Http/Requests/UserRequest.php b/app/Http/Requests/UserRequest.php index 0b19ef561..0c03da5d6 100644 --- a/app/Http/Requests/UserRequest.php +++ b/app/Http/Requests/UserRequest.php @@ -54,19 +54,20 @@ public function authorize() public function rules() { if ($this->isMethod('put')) { - $id = "," . $this->segment(4); + $id = ','.$this->segment(4); $password = ''; } else { - $id = ""; + $id = ''; $password = ['required', 'min:8', 'max:32', new Password()]; } + return [ - 'name' => 'required|regex:/^[A-Za-z\.\']+(?:\s[A-Za-z\.\']+)*$/u|max:255', - 'email' => 'required|email|unique:users,email' . $id, - 'phone' => 'nullable|numeric|digits_between:10,13', - 'password' => $password, - 'address' => 'required', - 'image' => 'nullable|image|mimes:jpg,jpeg,png|max:2048|valid_file', + 'name' => 'required|regex:/^[A-Za-z\.\']+(?:\s[A-Za-z\.\']+)*$/u|max:255', + 'email' => 'required|email|unique:users,email'.$id, + 'phone' => 'nullable|numeric|digits_between:10,13', + 'password' => $password, + 'address' => 'required', + 'image' => 'nullable|image|mimes:jpg,jpeg,png|max:2048|valid_file', 'pengurus_id' => 'nullable|integer', ]; } diff --git a/app/Http/Resources/SuratResource.php b/app/Http/Resources/SuratResource.php index 89156023f..f6ca7944a 100644 --- a/app/Http/Resources/SuratResource.php +++ b/app/Http/Resources/SuratResource.php @@ -37,20 +37,21 @@ class SuratResource extends JsonResource { //define properti public $status; + public $message; /** * __construct * - * @param mixed $status - * @param mixed $message - * @param mixed $resource + * @param mixed $status + * @param mixed $message + * @param mixed $resource * @return void */ public function __construct($status, $message, $resource) { parent::__construct($resource); - $this->status = $status; + $this->status = $status; $this->message = $message; } @@ -63,9 +64,9 @@ public function __construct($status, $message, $resource) public function toArray($request) { return [ - 'success' => $this->status, - 'message' => $this->message, - 'data' => $this->resource + 'success' => $this->status, + 'message' => $this->message, + 'data' => $this->resource, ]; } } diff --git a/app/Imports/ImporAKIAKB.php b/app/Imports/ImporAKIAKB.php index bd375ead2..2d54ecd02 100644 --- a/app/Imports/ImporAKIAKB.php +++ b/app/Imports/ImporAKIAKB.php @@ -48,7 +48,7 @@ class ImporAKIAKB implements ToCollection, WithHeadingRow, WithChunkReading, Sho { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -72,25 +72,25 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } $insert = [ - 'desa_id' => $value['desa_id'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], - 'aki' => $value['jumlah_aki'], - 'akb' => $value['jumlah_akb'], + 'desa_id' => $value['desa_id'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], + 'aki' => $value['jumlah_aki'], + 'akb' => $value['jumlah_akb'], ]; AkiAkb::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'bulan' => $insert['bulan'], - 'tahun' => $insert['tahun'], + 'desa_id' => $insert['desa_id'], + 'bulan' => $insert['bulan'], + 'tahun' => $insert['tahun'], ], $insert); } DB::commit(); // commit data dan simpan ke dalam database diff --git a/app/Imports/ImporAPBDesa.php b/app/Imports/ImporAPBDesa.php index c69fc6321..7caddfd72 100644 --- a/app/Imports/ImporAPBDesa.php +++ b/app/Imports/ImporAPBDesa.php @@ -48,7 +48,6 @@ class ImporAPBDesa implements ToCollection, WithHeadingRow, WithChunkReading, Sh { use Importable; - /** @var $request */ protected $request; public function __construct(array $request) @@ -72,27 +71,27 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($this->request['desa'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($this->request['desa'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } $insert = [ - 'desa_id' => $this->request['desa'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], - 'no_akun' => $value['no_akun'], + 'desa_id' => $this->request['desa'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], + 'no_akun' => $value['no_akun'], 'nama_akun' => $value['nama_akun'], - 'jumlah' => $value['jumlah'], + 'jumlah' => $value['jumlah'], ]; AnggaranDesa::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'bulan' => $insert['bulan'], - 'tahun' => $insert['tahun'], - 'no_akun' => $value['no_akun'], + 'desa_id' => $insert['desa_id'], + 'bulan' => $insert['bulan'], + 'tahun' => $insert['tahun'], + 'no_akun' => $value['no_akun'], ], $insert); } DB::commit(); diff --git a/app/Imports/ImporAnggaranRealisasi.php b/app/Imports/ImporAnggaranRealisasi.php index 2003dff7a..fe51917d8 100644 --- a/app/Imports/ImporAnggaranRealisasi.php +++ b/app/Imports/ImporAnggaranRealisasi.php @@ -43,7 +43,7 @@ class ImporAnggaranRealisasi implements ToModel, WithHeadingRow, WithChunkReadin { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -65,15 +65,15 @@ public function chunkSize(): int public function model(array $row) { return new AnggaranRealisasi([ - 'profil_id' => Profil::first()->id, - 'total_anggaran' => $row['total_anggaran'], - 'total_belanja' => $row['total_belanja'], - 'belanja_pegawai' => $row['belanja_pegawai'], - 'belanja_barang_jasa' => $row['belanja_barang_jasa'], - 'belanja_modal' => $row['belanja_modal'], + 'profil_id' => Profil::first()->id, + 'total_anggaran' => $row['total_anggaran'], + 'total_belanja' => $row['total_belanja'], + 'belanja_pegawai' => $row['belanja_pegawai'], + 'belanja_barang_jasa' => $row['belanja_barang_jasa'], + 'belanja_modal' => $row['belanja_modal'], 'belanja_tidak_langsung' => $row['belanja_tidak_langsung'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], ]); } } diff --git a/app/Imports/ImporEpidemiPenyakit.php b/app/Imports/ImporEpidemiPenyakit.php index e31465b2c..40b675e79 100644 --- a/app/Imports/ImporEpidemiPenyakit.php +++ b/app/Imports/ImporEpidemiPenyakit.php @@ -32,7 +32,6 @@ namespace App\Imports; use App\Models\DataDesa; - use App\Models\EpidemiPenyakit; use Exception; use Illuminate\Contracts\Queue\ShouldQueue; @@ -49,7 +48,7 @@ class ImporEpidemiPenyakit implements ToCollection, WithHeadingRow, WithChunkRea { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -73,26 +72,26 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } $insert = [ - 'desa_id' => $value['desa_id'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], - 'penyakit_id' => $this->request['penyakit_id'], - 'jumlah_penderita' => $value['jumlah_penderita'], + 'desa_id' => $value['desa_id'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], + 'penyakit_id' => $this->request['penyakit_id'], + 'jumlah_penderita' => $value['jumlah_penderita'], ]; EpidemiPenyakit::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'bulan' => $insert['bulan'], - 'tahun' => $insert['tahun'], - 'penyakit_id' => $insert['penyakit_id'], + 'desa_id' => $insert['desa_id'], + 'bulan' => $insert['bulan'], + 'tahun' => $insert['tahun'], + 'penyakit_id' => $insert['penyakit_id'], ], $insert); } DB::commit(); // commit data dan simpan ke dalam database diff --git a/app/Imports/ImporFasilitasPaud.php b/app/Imports/ImporFasilitasPaud.php index d4cf92fd5..fdd7d3d59 100644 --- a/app/Imports/ImporFasilitasPaud.php +++ b/app/Imports/ImporFasilitasPaud.php @@ -42,7 +42,7 @@ class ImporFasilitasPaud implements ToModel, WithHeadingRow, WithChunkReading, S { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -64,12 +64,12 @@ public function chunkSize(): int public function model(array $row) { return new FasilitasPAUD([ - 'desa_id' => $this->request['desa_id'], - 'jumlah_paud' => $row['jumlah_paud_ra'], - 'jumlah_guru_paud' => $row['jumlah_guru_paud_ra'], + 'desa_id' => $this->request['desa_id'], + 'jumlah_paud' => $row['jumlah_paud_ra'], + 'jumlah_guru_paud' => $row['jumlah_guru_paud_ra'], 'jumlah_siswa_paud' => $row['jumlah_siswa_paud_ra'], - 'semester' => $this->request['semester'], - 'tahun' => $this->request['tahun'], + 'semester' => $this->request['semester'], + 'tahun' => $this->request['tahun'], ]); } } diff --git a/app/Imports/ImporImunisasi.php b/app/Imports/ImporImunisasi.php index e4de298ac..d7d989fbe 100644 --- a/app/Imports/ImporImunisasi.php +++ b/app/Imports/ImporImunisasi.php @@ -48,7 +48,7 @@ class ImporImunisasi implements ToCollection, WithHeadingRow, WithChunkReading, { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -72,24 +72,26 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } $insert = [ - 'desa_id' => $value['desa_id'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], + 'desa_id' => $value['desa_id'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], 'cakupan_imunisasi' => $value['cakupan_imunisasi'], + 'created_at' => now(), + 'updated_at' => now(), ]; Imunisasi::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'bulan' => $insert['bulan'], - 'tahun' => $insert['tahun'], + 'desa_id' => $insert['desa_id'], + 'bulan' => $insert['bulan'], + 'tahun' => $insert['tahun'], ], $insert); } DB::commit(); diff --git a/app/Imports/ImporLaporanApbdes.php b/app/Imports/ImporLaporanApbdes.php index 88738171e..a2fee5486 100644 --- a/app/Imports/ImporLaporanApbdes.php +++ b/app/Imports/ImporLaporanApbdes.php @@ -65,41 +65,41 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah Storage::deleteDirectory('temp'); // Hapus folder temp ketika gagal - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } - $file_name = $value['desa_id'] . '_' . $value['id'] . '_' . $value['nama_file']; + $file_name = $value['desa_id'].'_'.$value['id'].'_'.$value['nama_file']; $insert = [ - 'judul' => $value['judul'], - 'tahun' => $value['tahun'], - 'semester' => $value['semester'], - 'nama_file' => $file_name, - 'desa_id' => $value['desa_id'], - 'id_apbdes' => $value['id'], - 'created_at' => $value['created_at'], - 'updated_at' => $value['updated_at'], - 'imported_at' => now(), + 'judul' => $value['judul'], + 'tahun' => $value['tahun'], + 'semester' => $value['semester'], + 'nama_file' => $file_name, + 'desa_id' => $value['desa_id'], + 'id_apbdes' => $value['id'], + 'created_at' => $value['created_at'], + 'updated_at' => $value['updated_at'], + 'imported_at' => now(), ]; LaporanApbdes::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'id_apbdes' => $insert['id_apbdes'] + 'desa_id' => $insert['desa_id'], + 'id_apbdes' => $insert['id_apbdes'], ], $insert); // Hapus file yang lama - if (Storage::exists('public/apbdes/' . $file_name)) { - Storage::delete('public/apbdes/' . $file_name); + if (Storage::exists('public/apbdes/'.$file_name)) { + Storage::delete('public/apbdes/'.$file_name); } // Pindahkan file yang dibutuhkan - Storage::move('temp/apbdes/' . $value['nama_file'], 'public/apbdes/' . $file_name); + Storage::move('temp/apbdes/'.$value['nama_file'], 'public/apbdes/'.$file_name); } DB::commit(); // commit data dan simpan ke dalam database diff --git a/app/Imports/ImporLaporanPenduduk.php b/app/Imports/ImporLaporanPenduduk.php index 7df3fcb21..72291171e 100644 --- a/app/Imports/ImporLaporanPenduduk.php +++ b/app/Imports/ImporLaporanPenduduk.php @@ -62,30 +62,30 @@ public function collection(Collection $collection) try { foreach ($collection as $value) { - $file_name = $value['desa_id'] . '_laporan_penduduk_' . $value['bulan'] . '_' . $value['tahun'] . '.' . explode('.', $value['nama_file'])[1]; + $file_name = $value['desa_id'].'_laporan_penduduk_'.$value['bulan'].'_'.$value['tahun'].'.'.explode('.', $value['nama_file'])[1]; $insert = [ - 'judul' => $value['judul'], - 'bulan' => $value['bulan'], - 'tahun' => $value['tahun'], - 'nama_file' => $file_name, - 'desa_id' => $value['desa_id'], - 'id_laporan_penduduk' => $value['id'], - 'imported_at' => now(), + 'judul' => $value['judul'], + 'bulan' => $value['bulan'], + 'tahun' => $value['tahun'], + 'nama_file' => $file_name, + 'desa_id' => $value['desa_id'], + 'id_laporan_penduduk' => $value['id'], + 'imported_at' => now(), ]; LaporanPenduduk::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'id_laporan_penduduk' => $insert['id_laporan_penduduk'] + 'desa_id' => $insert['desa_id'], + 'id_laporan_penduduk' => $insert['id_laporan_penduduk'], ], $insert); // Hapus file yang lama - if (Storage::exists('public/laporan_penduduk/' . $file_name)) { - Storage::delete('public/laporan_penduduk/' . $file_name); + if (Storage::exists('public/laporan_penduduk/'.$file_name)) { + Storage::delete('public/laporan_penduduk/'.$file_name); } // Pindahkan file yang dibutuhkan saja - Storage::move('temp/laporan_penduduk/' . $value['nama_file'], 'public/laporan_penduduk/' . $file_name); + Storage::move('temp/laporan_penduduk/'.$value['nama_file'], 'public/laporan_penduduk/'.$file_name); } DB::commit(); diff --git a/app/Imports/ImporPendudukKeluarga.php b/app/Imports/ImporPendudukKeluarga.php index eefd5612b..44df64b7d 100644 --- a/app/Imports/ImporPendudukKeluarga.php +++ b/app/Imports/ImporPendudukKeluarga.php @@ -66,92 +66,92 @@ public function collection(Collection $collection) $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); DB::beginTransaction(); //multai transaction - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah Storage::deleteDirectory('temp'); // Hapus folder temp ketika gagal - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } // Data Keluarga if ($value['hubungan_keluarga'] == 1) { $keluarga = [ - 'no_kk' => $value['nomor_kk'], - 'nik_kepala' => $value['nomor_nik'], - 'tgl_daftar' => $value['tgl_daftar'] ?? now(), - 'tgl_cetak_kk' => $value['tgl_cetak_kk'] ?? now(), - 'alamat' => $value['alamat'], - 'dusun' => $value['dusun'], - 'rw' => $value['rw'], - 'rt' => $value['rt'], - 'desa_id' => $value['desa_id'], - 'created_at' => now(), - 'updated_at' => now(), + 'no_kk' => $value['nomor_kk'], + 'nik_kepala' => $value['nomor_nik'], + 'tgl_daftar' => $value['tgl_daftar'] ?? now(), + 'tgl_cetak_kk' => $value['tgl_cetak_kk'] ?? now(), + 'alamat' => $value['alamat'], + 'dusun' => $value['dusun'], + 'rw' => $value['rw'], + 'rt' => $value['rt'], + 'desa_id' => $value['desa_id'], + 'created_at' => now(), + 'updated_at' => now(), ]; Keluarga::updateOrInsert([ - 'desa_id' => $keluarga['desa_id'], - 'no_kk' => $keluarga['no_kk'] + 'desa_id' => $keluarga['desa_id'], + 'no_kk' => $keluarga['no_kk'], ], $keluarga); } // Data Penduduk $penduduk = [ - 'nik' => $value['nomor_nik'], - 'nama' => $value['nama'], - 'no_kk' => $value['nomor_kk'], - 'sex' => $value['jenis_kelamin'], - 'tempat_lahir' => $value['tempat_lahir'], - 'tanggal_lahir' => $value['tanggal_lahir'], - 'agama_id' => $value['agama'], - 'pendidikan_kk_id' => $value['pendidikan_dlm_kk'], - 'pendidikan_sedang_id' => $value['pendidikan_sdg_ditempuh'], - 'pekerjaan_id' => $value['pekerjaan'], - 'status_kawin' => $value['kawin'], - 'kk_level' => $value['hubungan_keluarga'], - 'warga_negara_id' => $value['kewarganegaraan'], - 'nama_ibu' => $value['nama_ibu'], - 'nama_ayah' => $value['nama_ayah'], - 'golongan_darah_id' => $value['gol_darah'], - 'akta_lahir' => $value['akta_lahir'], - 'dokumen_pasport' => $value['nomor_dokumen_pasport'], + 'nik' => $value['nomor_nik'], + 'nama' => $value['nama'], + 'no_kk' => $value['nomor_kk'], + 'sex' => $value['jenis_kelamin'], + 'tempat_lahir' => $value['tempat_lahir'], + 'tanggal_lahir' => $value['tanggal_lahir'], + 'agama_id' => $value['agama'], + 'pendidikan_kk_id' => $value['pendidikan_dlm_kk'], + 'pendidikan_sedang_id' => $value['pendidikan_sdg_ditempuh'], + 'pekerjaan_id' => $value['pekerjaan'], + 'status_kawin' => $value['kawin'], + 'kk_level' => $value['hubungan_keluarga'], + 'warga_negara_id' => $value['kewarganegaraan'], + 'nama_ibu' => $value['nama_ibu'], + 'nama_ayah' => $value['nama_ayah'], + 'golongan_darah_id' => $value['gol_darah'], + 'akta_lahir' => $value['akta_lahir'], + 'dokumen_pasport' => $value['nomor_dokumen_pasport'], 'tanggal_akhir_pasport' => $value['tanggal_akhir_pasport'], - 'dokumen_kitas' => $value['nomor_dokumen_kitas'], - 'ayah_nik' => $value['nik_ayah'], - 'ibu_nik' => $value['nik_ibu'], - 'akta_perkawinan' => $value['nomor_akta_perkawinan'], - 'tanggal_perkawinan' => $value['tanggal_perkawinan'], - 'akta_perceraian' => $value['nomor_akta_perceraian'], - 'tanggal_perceraian' => $value['tanggal_perceraian'], - 'cacat_id' => $value['cacat'], - 'cara_kb_id' => $value['cara_kb'], - 'hamil' => $value['hamil'], + 'dokumen_kitas' => $value['nomor_dokumen_kitas'], + 'ayah_nik' => $value['nik_ayah'], + 'ibu_nik' => $value['nik_ibu'], + 'akta_perkawinan' => $value['nomor_akta_perkawinan'], + 'tanggal_perkawinan' => $value['tanggal_perkawinan'], + 'akta_perceraian' => $value['nomor_akta_perceraian'], + 'tanggal_perceraian' => $value['tanggal_perceraian'], + 'cacat_id' => $value['cacat'], + 'cara_kb_id' => $value['cara_kb'], + 'hamil' => $value['hamil'], // Tambahan - 'foto' => $value['foto'], + 'foto' => $value['foto'], 'alamat_sekarang' => $value['alamat_sekarang'], - 'alamat' => $value['alamat'], - 'dusun' => $value['dusun'], - 'rw' => $value['rw'], - 'rt' => $value['rt'], - 'desa_id' => $value['desa_id'], - 'status_dasar' => $value['status_dasar'], - 'status_rekam' => $value['status_rekam'], - 'created_at' => $value['created_at'], - 'updated_at' => $value['updated_at'], - 'imported_at' => now(), + 'alamat' => $value['alamat'], + 'dusun' => $value['dusun'], + 'rw' => $value['rw'], + 'rt' => $value['rt'], + 'desa_id' => $value['desa_id'], + 'status_dasar' => $value['status_dasar'], + 'status_rekam' => $value['status_rekam'], + 'created_at' => $value['created_at'], + 'updated_at' => $value['updated_at'], + 'imported_at' => now(), ]; Penduduk::updateOrInsert([ - 'desa_id' => $penduduk['desa_id'], - 'nik' => $penduduk['nik'], + 'desa_id' => $penduduk['desa_id'], + 'nik' => $penduduk['nik'], ], $penduduk); if ($value['foto']) { - $temp_foto = 'temp/penduduk/foto/' . $value['foto']; - $public_foto = 'public/penduduk/foto/' . $value['foto']; + $temp_foto = 'temp/penduduk/foto/'.$value['foto']; + $public_foto = 'public/penduduk/foto/'.$value['foto']; // Salin file yang dibutuhkan if (Storage::exists($temp_foto)) { diff --git a/app/Imports/ImporPutusSekolah.php b/app/Imports/ImporPutusSekolah.php index 8c1e61100..77bf4648f 100644 --- a/app/Imports/ImporPutusSekolah.php +++ b/app/Imports/ImporPutusSekolah.php @@ -42,7 +42,7 @@ class ImporPutusSekolah implements ToModel, WithHeadingRow, WithChunkReading, Sh { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -64,17 +64,17 @@ public function chunkSize(): int public function model(array $row) { return new PutusSekolah([ - 'desa_id' => $this->request['desa_id'], - 'siswa_paud' => $row['siswa_paud_ra'], + 'desa_id' => $this->request['desa_id'], + 'siswa_paud' => $row['siswa_paud_ra'], 'anak_usia_paud' => $row['anak_usia_paud_ra'], - 'siswa_sd' => $row['siswa_sd_mi'], - 'anak_usia_sd' => $row['anak_usia_sd_mi'], - 'siswa_smp' => $row['siswa_smp_mts'], - 'anak_usia_smp' => $row['anak_usia_smp_mts'], - 'siswa_sma' => $row['siswa_sma_ma'], - 'anak_usia_sma' => $row['anak_usia_sma_ma'], - 'semester' => $this->request['semester'], - 'tahun' => $this->request['tahun'], + 'siswa_sd' => $row['siswa_sd_mi'], + 'anak_usia_sd' => $row['anak_usia_sd_mi'], + 'siswa_smp' => $row['siswa_smp_mts'], + 'anak_usia_smp' => $row['anak_usia_smp_mts'], + 'siswa_sma' => $row['siswa_sma_ma'], + 'anak_usia_sma' => $row['anak_usia_sma_ma'], + 'semester' => $this->request['semester'], + 'tahun' => $this->request['tahun'], ]); } } diff --git a/app/Imports/ImporTingkatPendidikan.php b/app/Imports/ImporTingkatPendidikan.php index 77cf604fa..cf9ed1d3c 100644 --- a/app/Imports/ImporTingkatPendidikan.php +++ b/app/Imports/ImporTingkatPendidikan.php @@ -45,7 +45,7 @@ class ImporTingkatPendidikan implements ToCollection, WithHeadingRow, WithChunkR { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -71,28 +71,28 @@ public function collection(Collection $collection) try { $import = LogImport::create([ 'nama_tabel' => 'das_tingkat_pendidikan', - 'desa_id' => $this->request['desa_id'], - 'bulan' => now()->month, - 'tahun' => $this->request['tahun'], + 'desa_id' => $this->request['desa_id'], + 'bulan' => now()->month, + 'tahun' => $this->request['tahun'], ]); foreach ($collection as $value) { $insert = [ - 'desa_id' => $this->request['desa_id'], - 'semester' => $this->request['semester'], - 'tahun' => $this->request['tahun'], - 'tidak_tamat_sekolah' => $value['tidak_tamat_sekolah'], - 'tamat_sd' => $value['tamat_sd_sederajat'], - 'tamat_smp' => $value['tamat_smp_sederajat'], - 'tamat_sma' => $value['tamat_sma_sederajat'], + 'desa_id' => $this->request['desa_id'], + 'semester' => $this->request['semester'], + 'tahun' => $this->request['tahun'], + 'tidak_tamat_sekolah' => $value['tidak_tamat_sekolah'], + 'tamat_sd' => $value['tamat_sd_sederajat'], + 'tamat_smp' => $value['tamat_smp_sederajat'], + 'tamat_sma' => $value['tamat_sma_sederajat'], 'tamat_diploma_sederajat' => $value['tamat_diploma_sederajat'], - 'import_id' => $import->id, + 'import_id' => $import->id, ]; TingkatPendidikan::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'semester' => $insert['semester'], - 'tahun' => $insert['tahun'], + 'desa_id' => $insert['desa_id'], + 'semester' => $insert['semester'], + 'tahun' => $insert['tahun'], ], $insert); } diff --git a/app/Imports/ImporToiletSanitasi.php b/app/Imports/ImporToiletSanitasi.php index 53b7433d3..f06037815 100644 --- a/app/Imports/ImporToiletSanitasi.php +++ b/app/Imports/ImporToiletSanitasi.php @@ -42,7 +42,7 @@ class ImporToiletSanitasi implements ToModel, WithHeadingRow, WithChunkReading, { use Importable; - /** @var array $request */ + /** @var array */ protected $request; public function __construct(array $request) @@ -64,11 +64,11 @@ public function chunkSize(): int public function model(array $row) { return new ToiletSanitasi([ - 'desa_id' => $row['desa_id'], - 'bulan' => $this->request['bulan'], - 'tahun' => $this->request['tahun'], - 'toilet' => $row['toilet'], - 'sanitasi' => $row['sanitasi'], + 'desa_id' => $row['desa_id'], + 'bulan' => $this->request['bulan'], + 'tahun' => $this->request['tahun'], + 'toilet' => $row['toilet'], + 'sanitasi' => $row['sanitasi'], ]); } } diff --git a/app/Imports/SinkronBantuan.php b/app/Imports/SinkronBantuan.php index a3a6355a2..921e4c8dc 100644 --- a/app/Imports/SinkronBantuan.php +++ b/app/Imports/SinkronBantuan.php @@ -52,9 +52,6 @@ public function chunkSize(): int return 1000; } - /** - * @param Collection $collection - */ public function collection(Collection $collection) { foreach ($collection as $data) { @@ -67,19 +64,19 @@ public function collection(Collection $collection) foreach ($collection as $value) { $insert = [ - 'desa_id' => $value['desa_id'], - 'id' => $value['id'], - 'nama' => $value['nama'], - 'sasaran' => $value['sasaran'], - 'status' => $value['status'], - 'start_date' => $value['sdate'], - 'end_date' => $value['edate'], - 'description' => $value['ndesc'], + 'desa_id' => $value['desa_id'], + 'id' => $value['id'], + 'nama' => $value['nama'], + 'sasaran' => $value['sasaran'], + 'status' => $value['status'], + 'start_date' => $value['sdate'], + 'end_date' => $value['edate'], + 'description' => $value['ndesc'], ]; Program::updateOrCreate([ 'desa_id' => $insert['desa_id'], - 'id' => $insert['id'] + 'id' => $insert['id'], ], $insert); } } diff --git a/app/Imports/SinkronPembangunan.php b/app/Imports/SinkronPembangunan.php index 6a7135280..1c31f159b 100644 --- a/app/Imports/SinkronPembangunan.php +++ b/app/Imports/SinkronPembangunan.php @@ -51,38 +51,35 @@ public function chunkSize(): int return 1000; } - /** - * @param Collection $collection - */ public function collection(Collection $collection) { foreach ($collection as $value) { $insert = [ - "desa_id" => $value['desa_id'], - "id" => $value['id'], - "sumber_dana" => $value['sumber_dana'], - "lokasi" => $value['lokasi'], - "keterangan" => $value['keterangan'], - "judul" => $value['judul'], - "volume" => $value['volume'], - "tahun_anggaran" => $value['tahun_anggaran'], - "pelaksana_kegiatan" => $value['pelaksana_kegiatan'], - "status" => $value['status'], - "anggaran" => $value['anggaran'], - "perubahan_anggaran" => $value['perubahan_anggaran'], - "sumber_biaya_pemerintah" => $value['sumber_biaya_pemerintah'], - "sumber_biaya_provinsi" => $value['sumber_biaya_provinsi'], - "sumber_biaya_kab_kota" => $value['sumber_biaya_kab_kota'], - "sumber_biaya_swadaya" => $value['sumber_biaya_swadaya'], - "sumber_biaya_jumlah" => $value['sumber_biaya_jumlah'], - "manfaat" => $value['manfaat'], - "waktu" => $value['waktu'], - "foto" => $value['foto'], + 'desa_id' => $value['desa_id'], + 'id' => $value['id'], + 'sumber_dana' => $value['sumber_dana'], + 'lokasi' => $value['lokasi'], + 'keterangan' => $value['keterangan'], + 'judul' => $value['judul'], + 'volume' => $value['volume'], + 'tahun_anggaran' => $value['tahun_anggaran'], + 'pelaksana_kegiatan' => $value['pelaksana_kegiatan'], + 'status' => $value['status'], + 'anggaran' => $value['anggaran'], + 'perubahan_anggaran' => $value['perubahan_anggaran'], + 'sumber_biaya_pemerintah' => $value['sumber_biaya_pemerintah'], + 'sumber_biaya_provinsi' => $value['sumber_biaya_provinsi'], + 'sumber_biaya_kab_kota' => $value['sumber_biaya_kab_kota'], + 'sumber_biaya_swadaya' => $value['sumber_biaya_swadaya'], + 'sumber_biaya_jumlah' => $value['sumber_biaya_jumlah'], + 'manfaat' => $value['manfaat'], + 'waktu' => $value['waktu'], + 'foto' => $value['foto'], ]; Pembangunan::updateOrCreate([ 'desa_id' => $insert['desa_id'], - 'id' => $insert['id'] + 'id' => $insert['id'], ], $insert); } } diff --git a/app/Imports/SinkronPembangunanDokumentasi.php b/app/Imports/SinkronPembangunanDokumentasi.php index 06d170bfe..58286b15f 100644 --- a/app/Imports/SinkronPembangunanDokumentasi.php +++ b/app/Imports/SinkronPembangunanDokumentasi.php @@ -51,27 +51,24 @@ public function chunkSize(): int return 1000; } - /** - * @param Collection $collection - */ public function collection(Collection $collection) { foreach ($collection as $value) { $insert = [ - "desa_id" => $value['desa_id'], - "id" => $value['id'], - "id_pembangunan" => $value['id_pembangunan'], - "gambar" => $value['gambar'], - "persentase" => $value['persentase'], - "keterangan" => $value['keterangan'], - "created_at" => $value['created_at'], - "updated_at" => $value['updated_at'], + 'desa_id' => $value['desa_id'], + 'id' => $value['id'], + 'id_pembangunan' => $value['id_pembangunan'], + 'gambar' => $value['gambar'], + 'persentase' => $value['persentase'], + 'keterangan' => $value['keterangan'], + 'created_at' => $value['created_at'], + 'updated_at' => $value['updated_at'], ]; PembangunanDokumentasi::updateOrCreate([ - 'desa_id' => $insert['desa_id'], - 'id' => $insert['id'], - 'id_pembangunan' => $insert['id_pembangunan'] + 'desa_id' => $insert['desa_id'], + 'id' => $insert['id'], + 'id_pembangunan' => $insert['id_pembangunan'], ], $insert); } } diff --git a/app/Imports/SinkronPenduduk.php b/app/Imports/SinkronPenduduk.php index a7b75df7c..417698317 100644 --- a/app/Imports/SinkronPenduduk.php +++ b/app/Imports/SinkronPenduduk.php @@ -65,64 +65,64 @@ public function collection(Collection $collection) { $kode_desa = Arr::flatten(DataDesa::pluck('desa_id')); - foreach ($collection as $value) { - if (!in_array($value['desa_id'], $kode_desa)) { + foreach ($collection as $index => $value) { + if (! in_array($value['desa_id'], $kode_desa)) { Log::debug('Desa tidak terdaftar'); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah Storage::deleteDirectory('temp'); // Hapus folder temp ketika gagal - throw new Exception('kode Desa tidak terdaftar . kode desa yang bermasalah : '. $value['desa_id']); + throw new Exception('kode Desa pada baris ke-'.$index + 2 .' tidak terdaftar . kode desa yang bermasalah : '.$value['desa_id']); } $insert = [ - 'nik' => $value['nomor_nik'], - 'nama' => $value['nama'], - 'no_kk' => $value['nomor_kk'], - 'sex' => $value['jenis_kelamin'], - 'tempat_lahir' => $value['tempat_lahir'], - 'tanggal_lahir' => $value['tanggal_lahir'], - 'agama_id' => $value['agama'], - 'pendidikan_kk_id' => $value['pendidikan_dlm_kk'], - 'pendidikan_sedang_id' => $value['pendidikan_sdg_ditempuh'], - 'pekerjaan_id' => $value['pekerjaan'], - 'status_kawin' => $value['kawin'], - 'kk_level' => $value['hubungan_keluarga'], - 'warga_negara_id' => $value['kewarganegaraan'], - 'nama_ibu' => $value['nama_ibu'], - 'nama_ayah' => $value['nama_ayah'], - 'golongan_darah_id' => $value['gol_darah'], - 'akta_lahir' => $value['akta_lahir'], - 'dokumen_pasport' => $value['nomor_dokumen_pasport'], + 'nik' => $value['nomor_nik'], + 'nama' => $value['nama'], + 'no_kk' => $value['nomor_kk'], + 'sex' => $value['jenis_kelamin'], + 'tempat_lahir' => $value['tempat_lahir'], + 'tanggal_lahir' => $value['tanggal_lahir'], + 'agama_id' => $value['agama'], + 'pendidikan_kk_id' => $value['pendidikan_dlm_kk'], + 'pendidikan_sedang_id' => $value['pendidikan_sdg_ditempuh'], + 'pekerjaan_id' => $value['pekerjaan'], + 'status_kawin' => $value['kawin'], + 'kk_level' => $value['hubungan_keluarga'], + 'warga_negara_id' => $value['kewarganegaraan'], + 'nama_ibu' => $value['nama_ibu'], + 'nama_ayah' => $value['nama_ayah'], + 'golongan_darah_id' => $value['gol_darah'], + 'akta_lahir' => $value['akta_lahir'], + 'dokumen_pasport' => $value['nomor_dokumen_pasport'], 'tanggal_akhir_pasport' => $value['tanggal_akhir_pasport'], - 'dokumen_kitas' => $value['nomor_dokumen_kitas'], - 'ayah_nik' => $value['nik_ayah'], - 'ibu_nik' => $value['nik_ibu'], - 'akta_perkawinan' => $value['nomor_akta_perkawinan'], - 'tanggal_perkawinan' => $value['tanggal_perkawinan'], - 'akta_perceraian' => $value['nomor_akta_perceraian'], - 'tanggal_perceraian' => $value['tanggal_perceraian'], - 'cacat_id' => $value['cacat'], - 'cara_kb_id' => $value['cara_kb'], - 'hamil' => $value['hamil'], + 'dokumen_kitas' => $value['nomor_dokumen_kitas'], + 'ayah_nik' => $value['nik_ayah'], + 'ibu_nik' => $value['nik_ibu'], + 'akta_perkawinan' => $value['nomor_akta_perkawinan'], + 'tanggal_perkawinan' => $value['tanggal_perkawinan'], + 'akta_perceraian' => $value['nomor_akta_perceraian'], + 'tanggal_perceraian' => $value['tanggal_perceraian'], + 'cacat_id' => $value['cacat'], + 'cara_kb_id' => $value['cara_kb'], + 'hamil' => $value['hamil'], // Tambahan - 'foto' => $value['foto'], + 'foto' => $value['foto'], 'alamat_sekarang' => $value['alamat_sekarang'], - 'alamat' => $value['alamat'], - 'dusun' => $value['dusun'], - 'rw' => $value['rw'], - 'rt' => $value['rt'], - 'desa_id' => $value['desa_id'], - 'id_pend_desa' => $value['id'], - 'status_dasar' => $value['status_dasar'], - 'status_rekam' => $value['status_rekam'], - 'created_at' => $value['created_at'], - 'updated_at' => $value['updated_at'], - 'imported_at' => now(), + 'alamat' => $value['alamat'], + 'dusun' => $value['dusun'], + 'rw' => $value['rw'], + 'rt' => $value['rt'], + 'desa_id' => $value['desa_id'], + 'id_pend_desa' => $value['id'], + 'status_dasar' => $value['status_dasar'], + 'status_rekam' => $value['status_rekam'], + 'created_at' => $value['created_at'], + 'updated_at' => $value['updated_at'], + 'imported_at' => now(), ]; Penduduk::updateOrInsert([ - 'desa_id' => $insert['desa_id'], + 'desa_id' => $insert['desa_id'], 'id_pend_desa' => $insert['id_pend_desa'], ], $insert); } diff --git a/app/Imports/SinkronPesertaBantuan.php b/app/Imports/SinkronPesertaBantuan.php index 286b11788..f9150b383 100644 --- a/app/Imports/SinkronPesertaBantuan.php +++ b/app/Imports/SinkronPesertaBantuan.php @@ -56,9 +56,6 @@ public function chunkSize(): int return 1000; } - /** - * @param Collection $collection - */ public function collection(Collection $collection) { DB::beginTransaction(); //multai transaction @@ -66,7 +63,7 @@ public function collection(Collection $collection) foreach ($collection as $value) { if ($value['sasaran'] == 1) { // cek nik penduduk - if (!Penduduk::where('nik', $value['kartu_nik'])->exists()) { + if (! Penduduk::where('nik', $value['kartu_nik'])->exists()) { Log::debug("Sinkronisasi Peserta Bantuan Gagal. Nomor NIK {$value['kartu_nik']} tidak terdaftar."); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah Storage::deleteDirectory('temp'); // Hapus folder temp ketika gagal @@ -74,7 +71,7 @@ public function collection(Collection $collection) } } else { // cek kk penduduk - if (!Penduduk::where('nik', $value['kartu_nik'])->whereHas('keluarga')->exists()) { + if (! Penduduk::where('nik', $value['kartu_nik'])->whereHas('keluarga')->exists()) { Log::debug("Sinkronisasi Peserta Bantuan Gagal. Nomor KK dari NIK {$value['kartu_nik']} tidak terdaftar."); DB::rollBack(); // rollback data yang sudah masuk karena ada data yang bermasalah Storage::deleteDirectory('temp'); // Hapus folder temp ketika gagal @@ -83,24 +80,24 @@ public function collection(Collection $collection) } $insert = [ - 'desa_id' => $value['desa_id'], - 'id' => $value['id'], - 'peserta' => $value['peserta'], - 'program_id' => $value['program_id'], - 'no_id_kartu' => $value['no_id_kartu'], - 'kartu_nik' => $value['kartu_nik'], - 'kartu_nama' => $value['kartu_nama'], - 'sasaran' => $value['sasaran'], - 'kartu_tempat_lahir' => $value['kartu_tempat_lahir'], - 'kartu_tanggal_lahir' => $value['kartu_tanggal_lahir'], - 'kartu_alamat' => $value['kartu_alamat'], - 'kartu_peserta' => $value['kartu_peserta'], + 'desa_id' => $value['desa_id'], + 'id' => $value['id'], + 'peserta' => $value['peserta'], + 'program_id' => $value['program_id'], + 'no_id_kartu' => $value['no_id_kartu'], + 'kartu_nik' => $value['kartu_nik'], + 'kartu_nama' => $value['kartu_nama'], + 'sasaran' => $value['sasaran'], + 'kartu_tempat_lahir' => $value['kartu_tempat_lahir'], + 'kartu_tanggal_lahir' => $value['kartu_tanggal_lahir'], + 'kartu_alamat' => $value['kartu_alamat'], + 'kartu_peserta' => $value['kartu_peserta'], ]; PesertaProgram::updateOrCreate([ - 'desa_id' => $insert['desa_id'], - 'program_id' => $insert['program_id'], - 'kartu_nik' => $insert['kartu_nik'], + 'desa_id' => $insert['desa_id'], + 'program_id' => $insert['program_id'], + 'kartu_nik' => $insert['kartu_nik'], ], $insert); } diff --git a/app/Jobs/LaporanApbdesQueueJob.php b/app/Jobs/LaporanApbdesQueueJob.php index bb15ee2a8..f8840ab58 100644 --- a/app/Jobs/LaporanApbdesQueueJob.php +++ b/app/Jobs/LaporanApbdesQueueJob.php @@ -46,14 +46,16 @@ class LaporanApbdesQueueJob implements ShouldQueue use InteractsWithQueue; use Queueable; use SerializesModels; + public $timeout = 0; + /** @var array request data */ protected $request; /** * Create a new job instance. * - * @param array $request + * @param array $request * @return void */ public function __construct($request) @@ -86,26 +88,26 @@ public function handle() if (isset($this->request['laporan_apbdes'])) { foreach ($this->request['laporan_apbdes'] as $value) { - $file_name = $desa_id . '_laporan_apbdes_' . $value['semester'] . '_' . $value['tahun'] . '.' . explode('.', $value['nama_file'])[1]; + $file_name = $desa_id.'_laporan_apbdes_'.$value['semester'].'_'.$value['tahun'].'.'.explode('.', $value['nama_file'])[1]; $insert = [ - 'judul' => $value['judul'], - 'tahun' => $value['tahun'], - 'semester' => $value['semester'], - 'nama_file' => $file_name, - 'desa_id' => $desa_id, - 'id_apbdes' => $value['id'], - 'imported_at' => now(), + 'judul' => $value['judul'], + 'tahun' => $value['tahun'], + 'semester' => $value['semester'], + 'nama_file' => $file_name, + 'desa_id' => $desa_id, + 'id_apbdes' => $value['id'], + 'imported_at' => now(), ]; LaporanApbdes::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'id_apbdes' => $insert['id_apbdes'], + 'desa_id' => $insert['desa_id'], + 'id_apbdes' => $insert['id_apbdes'], ], $insert); // Encode File $file = base64_decode($value['file']); - Storage::disk('public')->put('apbdes/' . $file_name, $file); + Storage::disk('public')->put('apbdes/'.$file_name, $file); } } diff --git a/app/Jobs/LaporanPendudukQueueJob.php b/app/Jobs/LaporanPendudukQueueJob.php index b400dba60..34b40c3be 100644 --- a/app/Jobs/LaporanPendudukQueueJob.php +++ b/app/Jobs/LaporanPendudukQueueJob.php @@ -46,14 +46,16 @@ class LaporanPendudukQueueJob implements ShouldQueue use InteractsWithQueue; use Queueable; use SerializesModels; + public $timeout = 0; + /** @var array request data */ protected $request; /** * Create a new job instance. * - * @param array $request + * @param array $request * @return void */ public function __construct($request) @@ -86,29 +88,29 @@ public function handle() if (isset($this->request['laporan_penduduk'])) { foreach ($this->request['laporan_penduduk'] as $value) { - $file_name = $desa_id . '_laporan_penduduk_' . $value['bulan'] . '_' . $value['tahun'] . '.' . explode('.', $value['nama_file'])[1]; + $file_name = $desa_id.'_laporan_penduduk_'.$value['bulan'].'_'.$value['tahun'].'.'.explode('.', $value['nama_file'])[1]; $insert = [ - 'judul' => $value['judul'], - 'bulan' => $value['bulan'], - 'tahun' => $value['tahun'], - 'nama_file' => $file_name, - 'desa_id' => $desa_id, - 'id_laporan_penduduk' => $value['id'], - 'imported_at' => now(), + 'judul' => $value['judul'], + 'bulan' => $value['bulan'], + 'tahun' => $value['tahun'], + 'nama_file' => $file_name, + 'desa_id' => $desa_id, + 'id_laporan_penduduk' => $value['id'], + 'imported_at' => now(), ]; LaporanPenduduk::updateOrInsert([ - 'desa_id' => $insert['desa_id'], - 'id_laporan_penduduk' => $insert['id_laporan_penduduk'] + 'desa_id' => $insert['desa_id'], + 'id_laporan_penduduk' => $insert['id_laporan_penduduk'], ], $insert); // Hapus file yang lama - if (Storage::exists('public/laporan_penduduk/' . $file_name)) { - Storage::delete('public/laporan_penduduk/' . $file_name); + if (Storage::exists('public/laporan_penduduk/'.$file_name)) { + Storage::delete('public/laporan_penduduk/'.$file_name); } - Storage::disk('public')->put('laporan_penduduk/' . $file_name, base64_decode($value['file'])); + Storage::disk('public')->put('laporan_penduduk/'.$file_name, base64_decode($value['file'])); } } diff --git a/app/Jobs/PendudukQueueJob.php b/app/Jobs/PendudukQueueJob.php index 948881154..89c888342 100644 --- a/app/Jobs/PendudukQueueJob.php +++ b/app/Jobs/PendudukQueueJob.php @@ -46,14 +46,16 @@ class PendudukQueueJob implements ShouldQueue use InteractsWithQueue; use Queueable; use SerializesModels; + public $timeout = 0; + /** @var array request data */ protected $request; /** * Create a new job instance. * - * @param array $request + * @param array $request * @return void */ public function __construct($request) @@ -95,7 +97,7 @@ public function handle() // Hapus file foto di folder foreach ($foto as $hapusfoto) { - Storage::disk('public')->delete('penduduk/foto/' . 'kecil_' . $hapusfoto); + Storage::disk('public')->delete('penduduk/foto/'.'kecil_'.$hapusfoto); } } diff --git a/app/Models/Artikel.php b/app/Models/Artikel.php index 9f708934e..cf2626965 100644 --- a/app/Models/Artikel.php +++ b/app/Models/Artikel.php @@ -31,13 +31,15 @@ namespace App\Models; -use Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; +use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Artikel extends Model { use Sluggable; + use HasFactory; protected $table = 'das_artikel'; @@ -45,13 +47,11 @@ class Artikel extends Model 'judul', 'gambar', 'isi', - 'status' + 'status', ]; /** * Return the sluggable configuration array for this model. - * - * @return array */ public function sluggable(): array { @@ -64,7 +64,7 @@ public function sluggable(): array public function getGambarAttribute() { - return $this->attributes['gambar'] ? Storage::url('artikel/' . $this->attributes['gambar']) : null; + return $this->attributes['gambar'] ? Storage::url('artikel/'.$this->attributes['gambar']) : null; } public function getIsiAttribute() diff --git a/app/Models/Coa.php b/app/Models/Coa.php index 19b0d73f4..0da54fd70 100644 --- a/app/Models/Coa.php +++ b/app/Models/Coa.php @@ -35,9 +35,11 @@ class Coa extends Model { - protected $table = 'ref_coa'; + protected $table = 'ref_coa'; + public $incrementing = false; - public $timestamps = false; + + public $timestamps = false; protected $fillable = [ 'sub_sub_id', diff --git a/app/Models/CoaType.php b/app/Models/CoaType.php index ca6857021..406f87af5 100644 --- a/app/Models/CoaType.php +++ b/app/Models/CoaType.php @@ -35,7 +35,8 @@ class CoaType extends Model { - protected $table = 'ref_coa_type'; + protected $table = 'ref_coa_type'; + public $incrementing = false; protected $fillable = [ diff --git a/app/Models/DataDesa.php b/app/Models/DataDesa.php index 360cca91d..b862317a2 100644 --- a/app/Models/DataDesa.php +++ b/app/Models/DataDesa.php @@ -44,7 +44,7 @@ class DataDesa extends Model 'sebutan_desa', 'website', 'luas_wilayah', - 'path' + 'path', ]; /** @@ -60,9 +60,10 @@ public function getWebsiteUrlFeedAttribute() $desa = [ 'desa_id' => $this->desa_id, - 'nama' => ucwords($this->sebutan_desa . ' ' . $this->nama), - 'website' => $this->website . 'index.php/feed' + 'nama' => ucwords($this->sebutan_desa.' '.$this->nama), + 'website' => $this->website.'index.php/feed', ]; + return $desa; } @@ -102,7 +103,7 @@ public function scopeNama($query, $value) /** * Scope query untuk website desa. * - * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeWebsiteUrl($query) diff --git a/app/Models/DataUmum.php b/app/Models/DataUmum.php index 8b4142f39..2c95b87f8 100644 --- a/app/Models/DataUmum.php +++ b/app/Models/DataUmum.php @@ -39,6 +39,7 @@ class DataUmum extends Model protected $table = 'das_data_umum'; protected $fillable = [ + 'tipologi', 'sejarah', 'ketinggian', 'sumber_luas_wilayah', @@ -63,7 +64,7 @@ class DataUmum extends Model 'embed_peta', 'path', 'lat', - 'lng' + 'lng', ]; protected $appends = ['luas_wilayah_dari_data_desa']; diff --git a/app/Models/Event.php b/app/Models/Event.php index 5a6e826ee..c109ddcd5 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -31,12 +31,14 @@ namespace App\Models; -use Carbon\Carbon; -use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Support\Carbon; use Illuminate\Database\Eloquent\Model; +use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Event extends Model { + use HasFactory; use Sluggable; protected $table = 'das_events'; @@ -49,12 +51,11 @@ class Event extends Model 'attendants', 'status', 'attachment', + 'slug', ]; /** * Return the sluggable configuration array for this model. - * - * @return array */ public function sluggable(): array { diff --git a/app/Models/Faq.php b/app/Models/Faq.php index 038a26531..8df1961cc 100644 --- a/app/Models/Faq.php +++ b/app/Models/Faq.php @@ -40,7 +40,6 @@ class Faq extends Model * * @var array */ - protected $table = 'das_faq'; protected $fillable = [ diff --git a/app/Models/FasilitasPAUD.php b/app/Models/FasilitasPAUD.php index a87a5b740..86fa9460b 100644 --- a/app/Models/FasilitasPAUD.php +++ b/app/Models/FasilitasPAUD.php @@ -35,7 +35,8 @@ class FasilitasPAUD extends Model { - protected $table = 'das_fasilitas_paud'; + protected $table = 'das_fasilitas_paud'; + protected $fillable = [ 'kecamatan_id', 'desa_id', diff --git a/app/Models/JenisPenyakit.php b/app/Models/JenisPenyakit.php index 270b12394..461d4743c 100644 --- a/app/Models/JenisPenyakit.php +++ b/app/Models/JenisPenyakit.php @@ -38,6 +38,6 @@ class JenisPenyakit extends Model protected $table = 'ref_penyakit'; protected $fillable = [ - 'nama' + 'nama', ]; } diff --git a/app/Models/KategoriKomplain.php b/app/Models/KategoriKomplain.php index aed076527..c50c8d2d6 100644 --- a/app/Models/KategoriKomplain.php +++ b/app/Models/KategoriKomplain.php @@ -41,13 +41,11 @@ class KategoriKomplain extends Model protected $table = 'das_kategori_komplain'; protected $fillable = [ - 'nama' + 'nama', ]; /** * Return the sluggable configuration array for this model. - * - * @return array */ public function sluggable(): array { diff --git a/app/Models/Keluarga.php b/app/Models/Keluarga.php index eec7207de..5aa441cc1 100644 --- a/app/Models/Keluarga.php +++ b/app/Models/Keluarga.php @@ -35,7 +35,7 @@ class Keluarga extends Model { - protected $table = 'das_keluarga'; + protected $table = 'das_keluarga'; protected $fillable = [ 'nik_kepala', diff --git a/app/Models/LaporanApbdes.php b/app/Models/LaporanApbdes.php index b509f8ac9..0561dfc0d 100644 --- a/app/Models/LaporanApbdes.php +++ b/app/Models/LaporanApbdes.php @@ -35,7 +35,7 @@ class LaporanApbdes extends Model { - protected $table = 'das_apbdes'; + protected $table = 'das_apbdes'; protected $fillable = [ 'judul', @@ -43,10 +43,10 @@ class LaporanApbdes extends Model 'semester', 'nama_file', 'desa_id', - 'imported_at' + 'imported_at', ]; - protected $guarded = []; + protected $guarded = []; /** * Relation Methods diff --git a/app/Models/LaporanPenduduk.php b/app/Models/LaporanPenduduk.php index 8802ef046..cdb8db66a 100644 --- a/app/Models/LaporanPenduduk.php +++ b/app/Models/LaporanPenduduk.php @@ -35,7 +35,7 @@ class LaporanPenduduk extends Model { - protected $table = 'das_laporan_penduduk'; + protected $table = 'das_laporan_penduduk'; protected $fillable = [ 'judul', @@ -43,7 +43,7 @@ class LaporanPenduduk extends Model 'tahun', 'nama_file', 'desa_id', - 'imported_at' + 'imported_at', ]; public function desa() diff --git a/app/Models/Menu.php b/app/Models/Menu.php index e51af05cd..d76a5921d 100644 --- a/app/Models/Menu.php +++ b/app/Models/Menu.php @@ -60,11 +60,9 @@ public static function datatables() } /** - * slug for menu name - * - * @return array + * Return the sluggable configuration array for this model. */ - public function sluggable() + public function sluggable(): array { return [ 'slug' => [ diff --git a/app/Models/Pembangunan.php b/app/Models/Pembangunan.php index fd072db18..6ee7d1e38 100644 --- a/app/Models/Pembangunan.php +++ b/app/Models/Pembangunan.php @@ -36,8 +36,10 @@ class Pembangunan extends Model { protected $table = 'das_pembangunan'; - protected $fillable = []; - protected $guarded = []; + + protected $fillable = []; + + protected $guarded = []; public function dokumentasi() { diff --git a/app/Models/PembangunanDokumentasi.php b/app/Models/PembangunanDokumentasi.php index bd7e3e2ad..940be4f16 100644 --- a/app/Models/PembangunanDokumentasi.php +++ b/app/Models/PembangunanDokumentasi.php @@ -36,8 +36,10 @@ class PembangunanDokumentasi extends Model { protected $table = 'das_pembangunan_dokumentasi'; - protected $fillable = []; - protected $guarded = []; + + protected $fillable = []; + + protected $guarded = []; public function pembangunan() { diff --git a/app/Models/Penduduk.php b/app/Models/Penduduk.php index c7263111b..39684a4d3 100644 --- a/app/Models/Penduduk.php +++ b/app/Models/Penduduk.php @@ -36,17 +36,19 @@ class Penduduk extends Model { public $incrementing = false; - protected $table = 'das_penduduk'; - protected $fillable = []; - protected $guarded = []; + + protected $table = 'das_penduduk'; + + protected $fillable = []; + + protected $guarded = []; /** * Relation Methods * */ - public function getPendudukAktif($did, $year) { - $penduduk = $this + $penduduk = $this ->where('status_dasar', 1) ->whereYear('created_at', '<=', $year); diff --git a/app/Models/Pengurus.php b/app/Models/Pengurus.php index b7882f04f..d013eb312 100644 --- a/app/Models/Pengurus.php +++ b/app/Models/Pengurus.php @@ -31,13 +31,16 @@ namespace App\Models; -use App\Enums\JenisJabatan; use App\Enums\Status; +use App\Enums\JenisJabatan; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Pengurus extends Model { + use HasFactory; + protected $table = 'das_pengurus'; protected $guarded = ['id', 'created_at', 'updated_at']; @@ -49,12 +52,12 @@ class Pengurus extends Model ]; protected $appends = [ - 'namaGelar' + 'namaGelar', ]; public function getFotoAttribute() { - return $this->attributes['foto'] ? Storage::url('pengurus/' . $this->attributes['foto']) : null; + return $this->attributes['foto'] ? Storage::url('pengurus/'.$this->attributes['foto']) : null; } /** @@ -64,10 +67,10 @@ public function getFotoAttribute() */ public function getNamaGelarAttribute() { - $nama = $this->attributes['gelar_depan'] . ' ' . $this->attributes['nama']; + $nama = $this->attributes['gelar_depan'].' '.$this->attributes['nama']; if ($this->attributes['gelar_belakang']) { - $nama = $nama . ', ' . $this->attributes['gelar_belakang']; + $nama = $nama.', '.$this->attributes['gelar_belakang']; } return $nama; diff --git a/app/Models/Pesan.php b/app/Models/Pesan.php index 6ab23af51..2cadca93f 100644 --- a/app/Models/Pesan.php +++ b/app/Models/Pesan.php @@ -35,14 +35,22 @@ class Pesan extends Model { - protected $table = 'das_pesan'; - protected $fillable = ['judul','das_data_desa_id', 'jenis', 'sudah_dibaca', 'created_at']; - public const PESAN_MASUK = "Pesan Masuk"; - public const PESAN_KELUAR = "Pesan Keluar"; + protected $table = 'das_pesan'; + + protected $fillable = ['judul', 'das_data_desa_id', 'jenis', 'sudah_dibaca', 'created_at']; + + public const PESAN_MASUK = 'Pesan Masuk'; + + public const PESAN_KELUAR = 'Pesan Keluar'; + public const BELUM_DIBACA = 0; + public const SUDAH_DIBACA = 1; + public const MASUK_ARSIP = 1; + public const NON_ARSIP = 0; + public const PER_PAGE = 10; public function detailPesan() @@ -52,7 +60,7 @@ public function detailPesan() public function dataDesa() { - return $this->hasOne(DataDesa::class, "id", "das_data_desa_id"); + return $this->hasOne(DataDesa::class, 'id', 'das_data_desa_id'); } public function getCustomDateAttribute() diff --git a/app/Models/PesanDetail.php b/app/Models/PesanDetail.php index 3fbbedc51..a224237fa 100644 --- a/app/Models/PesanDetail.php +++ b/app/Models/PesanDetail.php @@ -35,8 +35,9 @@ class PesanDetail extends Model { - protected $table = 'das_pesan_detail'; - protected $fillable = ['text','pesan_id','pengirim', 'nama_pengirim','jenis']; + protected $table = 'das_pesan_detail'; + + protected $fillable = ['text', 'pesan_id', 'pengirim', 'nama_pengirim', 'jenis']; public function headerPesan() { diff --git a/app/Models/PesertaProgram.php b/app/Models/PesertaProgram.php index bd11e2e0d..515e874ad 100644 --- a/app/Models/PesertaProgram.php +++ b/app/Models/PesertaProgram.php @@ -48,7 +48,7 @@ class PesertaProgram extends Model 'kartu_tanggal_lahir', 'kartu_alamat', 'kartu_peserta', - 'desa_id' + 'desa_id', ]; public function penduduk() diff --git a/app/Models/Profil.php b/app/Models/Profil.php index 03928e5f9..35cdf5977 100644 --- a/app/Models/Profil.php +++ b/app/Models/Profil.php @@ -62,13 +62,13 @@ class Profil extends Model ]; protected $cast = [ - 'socialmedia' => 'array' + 'socialmedia' => 'array', ]; public static function getProfilTanpaDataUmum() { $data_umums = DataUmum::get(); - $ids = []; + $ids = []; foreach ($data_umums as $val) { $ids[] = $val->kecamatan_id; } diff --git a/app/Models/Program.php b/app/Models/Program.php index c468a2d15..f58414a1a 100644 --- a/app/Models/Program.php +++ b/app/Models/Program.php @@ -45,7 +45,7 @@ class Program extends Model 'end_date', 'description', 'desa_id', - 'status' + 'status', ]; public function pesertas() diff --git a/app/Models/Prosedur.php b/app/Models/Prosedur.php index ce7db5402..47591e9f5 100644 --- a/app/Models/Prosedur.php +++ b/app/Models/Prosedur.php @@ -32,15 +32,34 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Cviebrock\EloquentSluggable\Sluggable; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Prosedur extends Model { + use HasFactory; + use Sluggable; + protected $table = 'das_prosedur'; protected $fillable = [ 'judul_prosedur', 'file_prosedur', 'mime_type', - 'slug' + 'slug', ]; + + /** + * Return the sluggable configuration array for this model. + */ + public function sluggable(): array + { + return [ + 'slug' => [ + 'source' => 'judul_prosedur', + ], + ]; + } + } + diff --git a/app/Models/PutusSekolah.php b/app/Models/PutusSekolah.php index b25dd9bf7..a440dc57f 100644 --- a/app/Models/PutusSekolah.php +++ b/app/Models/PutusSekolah.php @@ -35,7 +35,7 @@ class PutusSekolah extends Model { - protected $table = 'das_putus_sekolah'; + protected $table = 'das_putus_sekolah'; protected $fillable = [ 'desa_id', diff --git a/app/Models/Slide.php b/app/Models/Slide.php index 70b92d15d..491d28a42 100644 --- a/app/Models/Slide.php +++ b/app/Models/Slide.php @@ -40,6 +40,6 @@ class Slide extends Model protected $fillable = [ 'gambar', 'judul', - 'deskripsi' + 'deskripsi', ]; } diff --git a/app/Models/SubCoa.php b/app/Models/SubCoa.php index 7349fb375..cfc10b4c4 100644 --- a/app/Models/SubCoa.php +++ b/app/Models/SubCoa.php @@ -35,7 +35,8 @@ class SubCoa extends Model { - protected $table = 'ref_sub_coa'; + protected $table = 'ref_sub_coa'; + public $incrementing = false; protected $fillable = [ diff --git a/app/Models/SubSubCoa.php b/app/Models/SubSubCoa.php index d0587bd37..f50ec6f8c 100644 --- a/app/Models/SubSubCoa.php +++ b/app/Models/SubSubCoa.php @@ -35,7 +35,8 @@ class SubSubCoa extends Model { - protected $table = 'ref_sub_sub_coa'; + protected $table = 'ref_sub_sub_coa'; + public $incrementing = false; protected $fillable = [ diff --git a/app/Models/Suplemen.php b/app/Models/Suplemen.php index 7e618346c..fc43a4976 100644 --- a/app/Models/Suplemen.php +++ b/app/Models/Suplemen.php @@ -41,7 +41,7 @@ class Suplemen extends Model 'nama', 'slug', 'sasaran', - 'keterangan' + 'keterangan', ]; public function terdata() diff --git a/app/Models/SuplemenTerdata.php b/app/Models/SuplemenTerdata.php index 79cb6cf0f..3ed74915d 100644 --- a/app/Models/SuplemenTerdata.php +++ b/app/Models/SuplemenTerdata.php @@ -40,7 +40,7 @@ class SuplemenTerdata extends Model protected $fillable = [ 'suplemen_id', 'penduduk_id', - 'keterangan' + 'keterangan', ]; public function suplemen() diff --git a/resources/lang/zh-TW/installer_messages.php b/app/Models/Themes.php similarity index 54% rename from resources/lang/zh-TW/installer_messages.php rename to app/Models/Themes.php index 2c89f1737..e3561c16a 100644 --- a/resources/lang/zh-TW/installer_messages.php +++ b/app/Models/Themes.php @@ -29,65 +29,36 @@ * @link https://github.com/OpenSID/opendk */ -return [ +namespace App\Models; - /** - * - * Shared translations. - * - */ - 'title' => 'Laravel安裝程序', - 'next' => '下一步', - 'finish' => '安裝', +use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\File; - /** - * - * Home page translations. - * - */ - 'welcome' => [ - 'title' => '歡迎來到Laravel安裝程序', - 'message' => '歡迎來到安裝嚮導.', - ], +class Themes extends Model +{ + protected $table = 'das_themes'; - /** - * - * Requirements page translations. - * - */ - 'requirements' => [ - 'title' => '環境要求', - ], + protected $guarded = []; - /** - * - * Permissions page translations. - * - */ - 'permissions' => [ - 'title' => '權限', - ], + // append slug attribute + protected $appends = ['slug']; - /** - * - * Environment page translations. - * - */ - 'environment' => [ - 'title' => '環境設置', - 'save' => '保存 .env', - 'success' => '.env 文件保存成功.', - 'errors' => '無法保存 .env 文件, 請手動創建它.', - ], + public function getSlugAttribute() + { + return $this->vendor.'/'.$this->name; + } - /** - * - * Final page translations. - * - */ - 'final' => [ - 'title' => '完成', - 'finished' => '應用已成功安裝.', - 'exit' => '點擊退出', - ], -]; + public static function boot() + { + parent::boot(); + + static::deleting(function ($themes) { + if ($themes->system != 0) { + $path = base_path('themes/'.$themes->slug); + if (file_exists($path)) { + File::deleteDirectory($path); + } + } + }); + } +} diff --git a/app/Models/TingkatPendidikan.php b/app/Models/TingkatPendidikan.php index 4756ac209..e30ae5df4 100644 --- a/app/Models/TingkatPendidikan.php +++ b/app/Models/TingkatPendidikan.php @@ -35,7 +35,7 @@ class TingkatPendidikan extends Model { - protected $table = 'das_tingkat_pendidikan'; + protected $table = 'das_tingkat_pendidikan'; protected $fillable = [ 'desa_id', diff --git a/app/Models/TipePotensi.php b/app/Models/TipePotensi.php index 78924a987..762aab659 100644 --- a/app/Models/TipePotensi.php +++ b/app/Models/TipePotensi.php @@ -38,7 +38,7 @@ class TipePotensi extends Model { use Sluggable; - protected $table = 'das_tipe_potensi'; + protected $table = 'das_tipe_potensi'; protected $fillable = [ 'nama_kategori', @@ -47,8 +47,6 @@ class TipePotensi extends Model /** * Return the sluggable configuration array for this model. - * - * @return array */ public function sluggable(): array { diff --git a/app/Models/TipeRegulasi.php b/app/Models/TipeRegulasi.php index d90fbe97b..2ae177645 100644 --- a/app/Models/TipeRegulasi.php +++ b/app/Models/TipeRegulasi.php @@ -44,8 +44,6 @@ class TipeRegulasi extends Model /** * Return the sluggable configuration array for this model. - * - * @return array */ public function sluggable(): array { diff --git a/app/Models/User.php b/app/Models/User.php index 84b833257..9ab245171 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -102,7 +102,7 @@ public static function datatables() public function getFotoAttribute() { - return $this->attributes['image'] ? Storage::url('user/' . $this->attributes['image']) : null; + return $this->attributes['image'] ? Storage::url('user/'.$this->attributes['image']) : null; } /** @@ -114,15 +114,15 @@ public function getFotoAttribute() public function uploadImage($image) { $extension = $image->getClientOriginalExtension(); - $path = storage_path('app/public/user/'); + $path = storage_path('app/public/user/'); - if (!file_exists($path)) { + if (! file_exists($path)) { File::makeDirectory($path, 0777, true); } - $name = $this->id . '.' . $extension; - $img = Image::make($image->getRealPath()); - $img->save($path . $name); + $name = $this->id.'.'.$extension; + $img = Image::make($image->getRealPath()); + $img->save($path.$name); return $this->update(['image' => $name]); } @@ -134,7 +134,6 @@ public function scopeSuspend($query, $email) /** * Hash password - * @param $input */ public function setPasswordAttribute($input) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d667112fa..395f819d6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -82,10 +82,10 @@ protected function penduduk() Penduduk::saved(function ($model) { $dataUmum = DataUmum::where('kecamatan_id', $model->kecamatan_id)->first(); - $dataUmum->jumlah_penduduk = $model->where('kecamatan_id', $model->kecamatan_id)->count(); - $dataUmum->jml_laki_laki = $model->where('sex', 1)->count(); - $dataUmum->jml_perempuan = $model->where('sex', 2)->count(); - $dataUmum->luas_wilayah = DataDesa::where('kecamatan_id', $model->kecamatan_id)->sum('luas_wilayah'); + $dataUmum->jumlah_penduduk = $model->where('kecamatan_id', $model->kecamatan_id)->count(); + $dataUmum->jml_laki_laki = $model->where('sex', 1)->count(); + $dataUmum->jml_perempuan = $model->where('sex', 2)->count(); + $dataUmum->luas_wilayah = DataDesa::where('kecamatan_id', $model->kecamatan_id)->sum('luas_wilayah'); $dataUmum->kepadatan_penduduk = $dataUmum->luas_wilayah == 0 ? 0 : $dataUmum->jumlah_penduduk / $dataUmum->luas_wilayah; $dataUmum->save(); @@ -94,10 +94,10 @@ protected function penduduk() Penduduk::deleted(function ($model) { $dataUmum = DataUmum::where('kecamatan_id', $model->kecamatan_id)->first(); - $dataUmum->jumlah_penduduk = $model->where('kecamatan_id', $model->kecamatan_id)->count(); - $dataUmum->jml_laki_laki = $model->where('sex', 1)->count(); - $dataUmum->jml_perempuan = $model->where('sex', 2)->count(); - $dataUmum->luas_wilayah = DataDesa::where('kecamatan_id', $model->kecamatan_id)->sum('luas_wilayah'); + $dataUmum->jumlah_penduduk = $model->where('kecamatan_id', $model->kecamatan_id)->count(); + $dataUmum->jml_laki_laki = $model->where('sex', 1)->count(); + $dataUmum->jml_perempuan = $model->where('sex', 2)->count(); + $dataUmum->luas_wilayah = DataDesa::where('kecamatan_id', $model->kecamatan_id)->sum('luas_wilayah'); $dataUmum->kepadatan_penduduk = $dataUmum->luas_wilayah == 0 ? 0 : $dataUmum->jumlah_penduduk / $dataUmum->luas_wilayah; $dataUmum->save(); @@ -105,21 +105,23 @@ protected function penduduk() Validator::extend('nik_exists', function ($attribute, $value, $parameters) { $query = DB::table('das_penduduk')-> - where('nik', $value)->whereRaw("tanggal_lahir = '" . $parameters[0] . "'")->exists(); + where('nik', $value)->whereRaw("tanggal_lahir = '".$parameters[0]."'")->exists(); if ($query) { return true; } + return false; }); Validator::extend('password_exists', function ($attribute, $value, $parameters) { $query = DB::table('das_penduduk')-> - where('tanggal_lahir', $value)->whereRaw("nik = '" . $parameters[0] . "'")->exists(); + where('tanggal_lahir', $value)->whereRaw("nik = '".$parameters[0]."'")->exists(); if ($query) { return true; } + return false; }); @@ -128,20 +130,22 @@ protected function penduduk() ->where('key', $value) ->first(); - if (!$query || $query->id == $parameters[1]) { + if (! $query || $query->id == $parameters[1]) { return true; } + return false; }); Validator::extend('valid_json', function ($attributes, $value, $parameters) { - if (!is_string($value)) { + if (! is_string($value)) { return false; } json_decode($value); if (json_last_error() !== JSON_ERROR_NONE) { return false; } + return true; }); } @@ -201,6 +205,7 @@ protected function file() if ($contains) { return false; } + return true; }); } @@ -210,10 +215,10 @@ protected function paginate() /** * Paginate a standard Laravel Collection. * - * @param int $perPage - * @param int $total - * @param int $page - * @param string $pageName + * @param int $perPage + * @param int $total + * @param int $page + * @param string $pageName * @return array */ Collection::macro('paginate', function ($perPage, $total = null, $page = null, $pageName = 'page'): LengthAwarePaginator { diff --git a/app/Providers/KDServiceProvider.php b/app/Providers/KDServiceProvider.php index 7cae6fc8f..da571d4db 100644 --- a/app/Providers/KDServiceProvider.php +++ b/app/Providers/KDServiceProvider.php @@ -42,6 +42,7 @@ class KDServiceProvider extends ServiceProvider * @var bool */ protected $defer = false; + public function register() { $this->app->singleton('Counter', function () { diff --git a/app/Rules/CekDesa.php b/app/Rules/CekDesa.php index afe8d2f66..3830f3e9f 100644 --- a/app/Rules/CekDesa.php +++ b/app/Rules/CekDesa.php @@ -38,6 +38,7 @@ class CekDesa implements Rule { protected $nama_kecamatan; + protected $value; /** @@ -71,6 +72,6 @@ public function passes($attribute, $value) */ public function message() { - return 'Kode desa ' . $this->value . ' tidak dikenal di OpenDK Kecamatan ' . $this->nama_kecamatan; + return 'Kode desa '.$this->value.' tidak dikenal di OpenDK Kecamatan '.$this->nama_kecamatan; } } diff --git a/app/Rules/ValidDesa.php b/app/Rules/ValidDesa.php index b7904c5be..b0a3251bb 100644 --- a/app/Rules/ValidDesa.php +++ b/app/Rules/ValidDesa.php @@ -68,6 +68,6 @@ public function passes($attribute, $value) */ public function message() { - return 'Kode desa tidak dikenal di OpenDK Kecamatan ' . $this->nama_kecamatan; + return 'Kode desa tidak dikenal di OpenDK Kecamatan '.$this->nama_kecamatan; } } diff --git a/catatan_rilis.md b/catatan_rilis.md index a4943524d..092a090db 100644 --- a/catatan_rilis.md +++ b/catatan_rilis.md @@ -1,13 +1,34 @@ -Di rilis versi v2403.0.0 di versi ini terdapat penambahan lokasi kantor kecamatan dan perbaikan lain yang diminta Komunitas. +Di rilis versi v2407.0.0 di versi ini terdapat modul themes dan perbaikan lain yang diminta Komunitas. -#### Penambahan Fitur +Terima kasih pada @arifpriadi dan @nyomanjyotisa telah ikut berkontribusi. -1. [#908](https://github.com/OpenSID/OpenDK/issues/908) Buat menu lokasi kantor kecamatan. +#### FITUR -#### Perbaikan BUG +1. [#262](https://github.com/OpenSID/OpenDK/issues/262) Penambahan modul themes. +2. [#960](https://github.com/OpenSID/OpenDK/issues/960) Penambahan filter berdasarkan desa pada modul berkaitan dengan data desa. +3. [#962](https://github.com/OpenSID/OpenDK/issues/962) Penambahan unduh dan lihat pada halaman unduhan dokumen website. +4. [#958](https://github.com/OpenSID/OpenDK/issues/958) Penambahan informasi jika jenis penyakit belum tersedia pada modul epidemi penyakit. +5. [#959](https://github.com/OpenSID/OpenDK/issues/959) Penambahan informasi jika tipe potensi belum tersedia pada modul potensi. +6. [#640](https://github.com/OpenSID/OpenDK/issues/640) Penambahan halaman web tipologi. + + +#### BUG -1. [#666](https://github.com/OpenSID/OpenDK/issues/666) Download File surat TTE Camat di OpenDK/OpenSID tidak dapat dibuka. +1. [#930](https://github.com/OpenSID/OpenDK/issues/930) Perbaikan link email pada halaman website. +2. [#934](https://github.com/OpenSID/OpenDK/issues/934) Perbaikan tampilan widget pegawai kecamatan. +3. [#927](https://github.com/OpenSID/OpenDK/issues/927) Perbaikan keterangan gagal impor jika desa tidak terdaftar. +4. [#963](https://github.com/OpenSID/OpenDK/issues/963) Perbaikan slug pada menu. +5. [#961](https://github.com/OpenSID/OpenDK/issues/961) Perbaikan ubah profil saat data desa sudah ada. +6. [#966](https://github.com/OpenSID/OpenDK/issues/966) Perbaikan order pada modul pengurus. +7. [#967](https://github.com/OpenSID/OpenDK/issues/967) Perbaikan order pada modul jabatan. + -#### Perbaikan Teknis +#### TEKNIS -1. [#730](https://github.com/OpenSID/OpenDK/issues/730) Penambahan fungsi kirim data yang dikirim ke http://pantau.opensid.my.id/. \ No newline at end of file +1. [#845](https://github.com/OpenSID/OpenDK/issues/845) Penggunaan laravel pint. +2. [#957](https://github.com/OpenSID/OpenDK/issues/957) Penyesuaian carbon menggunakan bawaan laravel. +3. [#968](https://github.com/OpenSID/OpenDK/issues/968) Penyesuaian modul regulasi menggunakan datatable. +4. [#969](https://github.com/OpenSID/OpenDK/issues/969) Penyesuaian modul potensi menggunakan datatable. +5. [#965](https://github.com/OpenSID/OpenDK/issues/965) Penyesuaian seeders dan factories. +6. [#964](https://github.com/OpenSID/OpenDK/issues/964) Penyesuaian Lang (bahasa) yang tidak digunakan. +7. [#970](https://github.com/OpenSID/OpenDK/issues/970) Penyesuaian modul event menggunakan datatable. \ No newline at end of file diff --git a/composer.json b/composer.json index db89c9ea9..088cc7155 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "cviebrock/eloquent-sluggable": "^9.0", "doctrine/dbal": "^2.9", "guzzlehttp/guzzle": "^7.2", + "hexadog/laravel-themes-manager": "^1.13", "jaybizzle/crawler-detect": "1.*", "laracasts/flash": "^3.0", "laravel/framework": "^9.19", @@ -39,7 +40,7 @@ "beyondcode/laravel-query-detector": "^1.5", "fakerphp/faker": "^1.9.1", "filp/whoops": "~2.0", - "friendsofphp/php-cs-fixer": "^3.9", + "laravel/pint": "^1.5", "laravel/tinker": "^2.7", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", @@ -64,7 +65,8 @@ "config": { "allow-plugins": { "symfony/thanks": true, - "php-http/discovery": true + "php-http/discovery": true, + "hexadog/laravel-theme-installer": true }, "platform": { "php": "8.0.30" @@ -91,6 +93,9 @@ ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" + ], + "pint": [ + "./vendor/bin/pint" ] }, "minimum-stability": "dev", diff --git a/config/app.php b/config/app.php index 47b61b2f0..7726e91eb 100644 --- a/config/app.php +++ b/config/app.php @@ -39,7 +39,7 @@ |-------------------------------------------------------------------------- */ - 'version' => 'v2403.0.0', + 'version' => 'v2407.0.0', /* |-------------------------------------------------------------------------- @@ -177,7 +177,7 @@ | */ - 'faker_locale' => 'en_US', + 'faker_locale' => 'id_ID', /* |-------------------------------------------------------------------------- diff --git a/config/captcha.php b/config/captcha.php index 07302023e..51b22541c 100644 --- a/config/captcha.php +++ b/config/captcha.php @@ -33,42 +33,42 @@ 'characters' => '2346789abcdefghjmnpqrtuxyzABCDEFGHJMNPQRTUXYZ', - 'default' => [ - 'length' => 5, - 'width' => 120, - 'height' => 36, - 'quality' => 90, + 'default' => [ + 'length' => 5, + 'width' => 120, + 'height' => 36, + 'quality' => 90, ], - 'flat' => [ - 'length' => 6, - 'width' => 160, - 'height' => 46, - 'quality' => 90, - 'lines' => 6, - 'bgImage' => false, - 'bgColor' => '#ecf2f4', + 'flat' => [ + 'length' => 6, + 'width' => 160, + 'height' => 46, + 'quality' => 90, + 'lines' => 6, + 'bgImage' => false, + 'bgColor' => '#ecf2f4', 'fontColors' => ['#2c3e50', '#c0392b', '#16a085', '#c0392b', '#8e44ad', '#303f9f', '#f57c00', '#795548'], - 'contrast' => -5, + 'contrast' => -5, ], - 'mini' => [ - 'length' => 4, - 'width' => 100, - 'height' => 34, + 'mini' => [ + 'length' => 4, + 'width' => 100, + 'height' => 34, ], - 'inverse' => [ - 'length' => 5, - 'width' => 120, - 'height' => 36, - 'quality' => 90, + 'inverse' => [ + 'length' => 5, + 'width' => 120, + 'height' => 36, + 'quality' => 90, 'sensitive' => true, - 'angle' => 12, - 'sharpen' => 10, - 'blur' => 2, - 'invert' => true, - 'contrast' => -5, - ] + 'angle' => 12, + 'sharpen' => 10, + 'blur' => 2, + 'invert' => true, + 'contrast' => -5, + ], ]; diff --git a/config/datatables.php b/config/datatables.php index 8de3b89f6..e722f2dbf 100644 --- a/config/datatables.php +++ b/config/datatables.php @@ -33,17 +33,17 @@ /* * DataTables search options. */ - 'search' => [ + 'search' => [ /* * Smart search will enclose search keyword with wildcard string "%keyword%". * SQL: column LIKE "%keyword%" */ - 'smart' => true, + 'smart' => true, /* * Multi-term search will explode search keyword using spaces resulting into multiple term search. */ - 'multi_term' => true, + 'multi_term' => true, /* * Case insensitive will search the keyword in lower case format. @@ -55,29 +55,29 @@ * Wild card will add "%" in between every characters of the keyword. * SQL: column LIKE "%k%e%y%w%o%r%d%" */ - 'use_wildcards' => false, + 'use_wildcards' => false, /* * Perform a search which starts with the given keyword. * SQL: column LIKE "keyword%" */ - 'starts_with' => false, + 'starts_with' => false, ], /* * DataTables internal index id response column name. */ - 'index_column' => 'DT_RowIndex', + 'index_column' => 'DT_RowIndex', /* * List of available builders for DataTables. * This is where you can register your custom dataTables builder. */ - 'engines' => [ - 'eloquent' => Yajra\DataTables\EloquentDataTable::class, - 'query' => Yajra\DataTables\QueryDataTable::class, + 'engines' => [ + 'eloquent' => Yajra\DataTables\EloquentDataTable::class, + 'query' => Yajra\DataTables\QueryDataTable::class, 'collection' => Yajra\DataTables\CollectionDataTable::class, - 'resource' => Yajra\DataTables\ApiResourceDataTable::class, + 'resource' => Yajra\DataTables\ApiResourceDataTable::class, ], /* @@ -85,7 +85,7 @@ * This is where you can override which engine a builder should use * Note, only change this if you know what you are doing! */ - 'builders' => [ + 'builders' => [ //Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent', //Illuminate\Database\Eloquent\Builder::class => 'eloquent', //Illuminate\Database\Query\Builder::class => 'query', @@ -105,28 +105,28 @@ * 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed. * 'custom message' - Any friendly message to be displayed to the user. You can also use translation key. */ - 'error' => env('DATATABLES_ERROR', null), + 'error' => env('DATATABLES_ERROR', null), /* * Default columns definition of dataTable utility functions. */ - 'columns' => [ + 'columns' => [ /* * List of columns hidden/removed on json response. */ - 'excess' => ['rn', 'row_num'], + 'excess' => ['rn', 'row_num'], /* * List of columns to be escaped. If set to *, all columns are escape. * Note: You can set the value to empty array to disable XSS protection. */ - 'escape' => '*', + 'escape' => '*', /* * List of columns that are allowed to display html content. * Note: Adding columns to list will make us available to XSS attacks. */ - 'raw' => ['aksi'], + 'raw' => ['aksi'], /* * List of columns are are forbidden from being searched/sorted. @@ -143,8 +143,8 @@ /* * JsonResponse header and options config. */ - 'json' => [ - 'header' => [], + 'json' => [ + 'header' => [], 'options' => 0, ], diff --git a/config/debugbar.php b/config/debugbar.php index 3031a391b..81874f430 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -62,11 +62,11 @@ | */ 'storage' => [ - 'enabled' => true, - 'driver' => 'file', // redis, file, pdo, custom - 'path' => storage_path('debugbar'), // For file driver + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo, custom + 'path' => storage_path('debugbar'), // For file driver 'connection' => null, // Leave null for default connection (Redis/PDO) - 'provider' => '', // Instance of StorageInterface for custom driver + 'provider' => '', // Instance of StorageInterface for custom driver ], /* @@ -131,29 +131,29 @@ */ 'collectors' => [ - 'phpinfo' => true, // Php version - 'messages' => true, // Messages - 'time' => true, // Time Datalogger - 'memory' => true, // Memory usage - 'exceptions' => true, // Exception displayer - 'log' => true, // Logs from Monolog (merged in messages if enabled) - 'db' => true, // Show database (PDO) queries and bindings - 'views' => true, // Views with their data - 'route' => true, // Current route information - 'auth' => true, // Display Laravel authentication status - 'gate' => true, // Display Laravel Gate checks - 'session' => true, // Display session data + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'auth' => true, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data 'symfony_request' => true, // Only one can be enabled.. - 'mail' => true, // Catch mail messages - 'laravel' => false, // Laravel version and environment - 'events' => false, // All events fired + 'mail' => true, // Catch mail messages + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired 'default_request' => false, // Regular or special Symfony request logger - 'logs' => false, // Add the latest log messages - 'files' => false, // Show the included files - 'config' => false, // Display config settings - 'cache' => false, // Display cache events - 'models' => true, // Display models - 'livewire' => true, // Display Livewire (when available) + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'cache' => false, // Display cache events + 'models' => true, // Display models + 'livewire' => true, // Display Livewire (when available) ], /* @@ -170,16 +170,16 @@ 'show_name' => true, // Also show the users name/email in the debugbar ], 'db' => [ - 'with_params' => true, // Render SQL with the parameters substituted - 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. + 'with_params' => true, // Render SQL with the parameters substituted + 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. 'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults) - 'timeline' => false, // Add the queries to the timeline + 'timeline' => false, // Add the queries to the timeline 'explain' => [ // Show EXPLAIN output on queries 'enabled' => false, 'types' => ['SELECT'], // Deprecated setting, is always only SELECT ], - 'hints' => false, // Show hints for common mistakes - 'show_copy' => false, // Show copy button next to the query + 'hints' => false, // Show hints for common mistakes + 'show_copy' => false, // Show copy button next to the query ], 'mail' => [ 'full_log' => false, diff --git a/config/excel.php b/config/excel.php index 39c03886f..bada41e26 100644 --- a/config/excel.php +++ b/config/excel.php @@ -43,7 +43,7 @@ | Here you can specify how big the chunk should be. | */ - 'chunk_size' => 1000, + 'chunk_size' => 1000, /* |-------------------------------------------------------------------------- @@ -70,13 +70,13 @@ | Configure e.g. delimiter, enclosure and line ending for CSV exports. | */ - 'csv' => [ - 'delimiter' => ',', - 'enclosure' => '"', - 'line_ending' => PHP_EOL, - 'use_bom' => false, + 'csv' => [ + 'delimiter' => ',', + 'enclosure' => '"', + 'line_ending' => PHP_EOL, + 'use_bom' => false, 'include_separator_line' => false, - 'excel_compatibility' => false, + 'excel_compatibility' => false, ], /* @@ -87,20 +87,20 @@ | Configure e.g. default title, creator, subject,... | */ - 'properties' => [ - 'creator' => '', + 'properties' => [ + 'creator' => '', 'lastModifiedBy' => '', - 'title' => '', - 'description' => '', - 'subject' => '', - 'keywords' => '', - 'category' => '', - 'manager' => '', - 'company' => '', + 'title' => '', + 'description' => '', + 'subject' => '', + 'keywords' => '', + 'category' => '', + 'manager' => '', + 'company' => '', ], ], - 'imports' => [ + 'imports' => [ /* |-------------------------------------------------------------------------- @@ -149,12 +149,12 @@ | Configure e.g. delimiter, enclosure and line ending for CSV imports. | */ - 'csv' => [ - 'delimiter' => ',', - 'enclosure' => '"', + 'csv' => [ + 'delimiter' => ',', + 'enclosure' => '"', 'escape_character' => '\\', - 'contiguous' => false, - 'input_encoding' => 'UTF-8', + 'contiguous' => false, + 'input_encoding' => 'UTF-8', ], /* @@ -165,16 +165,16 @@ | Configure e.g. default title, creator, subject,... | */ - 'properties' => [ - 'creator' => '', + 'properties' => [ + 'creator' => '', 'lastModifiedBy' => '', - 'title' => '', - 'description' => '', - 'subject' => '', - 'keywords' => '', - 'category' => '', - 'manager' => '', - 'company' => '', + 'title' => '', + 'description' => '', + 'subject' => '', + 'keywords' => '', + 'category' => '', + 'manager' => '', + 'company' => '', ], ], @@ -189,21 +189,21 @@ | */ 'extension_detector' => [ - 'xlsx' => Excel::XLSX, - 'xlsm' => Excel::XLSX, - 'xltx' => Excel::XLSX, - 'xltm' => Excel::XLSX, - 'xls' => Excel::XLS, - 'xlt' => Excel::XLS, - 'ods' => Excel::ODS, - 'ots' => Excel::ODS, - 'slk' => Excel::SLK, - 'xml' => Excel::XML, + 'xlsx' => Excel::XLSX, + 'xlsm' => Excel::XLSX, + 'xltx' => Excel::XLSX, + 'xltm' => Excel::XLSX, + 'xls' => Excel::XLS, + 'xlt' => Excel::XLS, + 'ods' => Excel::ODS, + 'ots' => Excel::ODS, + 'slk' => Excel::SLK, + 'xml' => Excel::XML, 'gnumeric' => Excel::GNUMERIC, - 'htm' => Excel::HTML, - 'html' => Excel::HTML, - 'csv' => Excel::CSV, - 'tsv' => Excel::TSV, + 'htm' => Excel::HTML, + 'html' => Excel::HTML, + 'csv' => Excel::CSV, + 'tsv' => Excel::TSV, /* |-------------------------------------------------------------------------- @@ -214,7 +214,7 @@ | Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF | */ - 'pdf' => Excel::DOMPDF, + 'pdf' => Excel::DOMPDF, ], /* @@ -255,7 +255,7 @@ | Drivers: memory|illuminate|batch | */ - 'driver' => 'memory', + 'driver' => 'memory', /* |-------------------------------------------------------------------------- @@ -267,7 +267,7 @@ | Here you can tweak the memory limit to your liking. | */ - 'batch' => [ + 'batch' => [ 'memory_limit' => 60000, ], @@ -289,15 +289,15 @@ ], 'properties' => [ - 'creator' => 'Dashboard Kecamatan', + 'creator' => 'Dashboard Kecamatan', 'lastModifiedBy' => 'Dashboard Kecamatan', - 'title' => 'Spreadsheet', - 'description' => 'Default spreadsheet export', - 'subject' => 'Spreadsheet export', - 'keywords' => 'Dashboard Kecamatan, excel, export', - 'category' => 'Excel', - 'manager' => 'KOMPAK', - 'company' => 'KOMPAK', + 'title' => 'Spreadsheet', + 'description' => 'Default spreadsheet export', + 'subject' => 'Spreadsheet export', + 'keywords' => 'Dashboard Kecamatan, excel, export', + 'category' => 'Excel', + 'manager' => 'KOMPAK', + 'company' => 'KOMPAK', ], /* @@ -330,7 +330,7 @@ | storing reading or downloading. Here you can customize that path. | */ - 'local_path' => storage_path('framework/laravel-excel'), + 'local_path' => storage_path('framework/laravel-excel'), /* |-------------------------------------------------------------------------- @@ -346,8 +346,8 @@ | in conjunction with queued imports and exports. | */ - 'remote_disk' => null, - 'remote_prefix' => null, + 'remote_disk' => null, + 'remote_prefix' => null, /* |-------------------------------------------------------------------------- diff --git a/config/feeds.php b/config/feeds.php index 6ea6021d6..97e799369 100644 --- a/config/feeds.php +++ b/config/feeds.php @@ -40,7 +40,7 @@ | most cases. | */ - 'cache.location' => storage_path('framework/cache'), + 'cache.location' => storage_path('framework/cache'), /* |-------------------------------------------------------------------------- @@ -50,7 +50,7 @@ | Life of cache, in seconds | */ - 'cache.life' => 600, + 'cache.life' => 600, /* |-------------------------------------------------------------------------- @@ -60,7 +60,7 @@ | Whether to disable the cache. | */ - 'cache.disabled' => false, + 'cache.disabled' => false, /* |-------------------------------------------------------------------------- @@ -70,7 +70,7 @@ | | */ - 'ssl_check.disabled' => true, + 'ssl_check.disabled' => true, /* |-------------------------------------------------------------------------- @@ -90,7 +90,7 @@ | | */ - 'strip_html_tags.tags' => [ + 'strip_html_tags.tags' => [ 'base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style', ], @@ -113,7 +113,7 @@ | | */ - 'strip_attribute.tags' => [ + 'strip_attribute.tags' => [ 'bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc', ], @@ -127,7 +127,7 @@ | Set to null to disable | */ - 'curl.options' => null, + 'curl.options' => null, 'curl.timeout' => null, diff --git a/config/image.php b/config/image.php index f30317c11..dbe60d0f7 100644 --- a/config/image.php +++ b/config/image.php @@ -44,6 +44,6 @@ | */ - 'driver' => 'gd' + 'driver' => 'gd', ]; diff --git a/config/installer.php b/config/installer.php index afea95c3a..d0a126f71 100644 --- a/config/installer.php +++ b/config/installer.php @@ -42,11 +42,11 @@ | */ 'core' => [ - 'minPhpVersion' => '7.4.0' + 'minPhpVersion' => '7.4.0', ], 'final' => [ 'key' => true, - 'publish' => false + 'publish' => false, ], 'requirements' => [ 'php' => [ @@ -72,9 +72,9 @@ | */ 'permissions' => [ - 'storage/framework/' => '775', - 'storage/logs/' => '775', - 'bootstrap/cache/' => '775' + 'storage/framework/' => '775', + 'storage/logs/' => '775', + 'bootstrap/cache/' => '775', ], /* @@ -89,34 +89,34 @@ 'environment' => [ 'form' => [ 'rules' => [ - 'app_name' => 'required|string|max:50', - 'environment' => 'required|string|max:50', - 'environment_custom' => 'required_if:environment,other|max:50', - 'app_debug' => 'required|string', - 'app_log_level' => 'required|string|max:50', - 'app_url' => 'required|url', - 'database_connection' => 'required|string|max:50', - 'database_hostname' => 'required|string|max:50', - 'database_port' => 'required|numeric', - 'database_name' => 'required|string|max:50', - 'database_username' => 'required|string|max:50', - 'database_password' => 'string|max:50|nullable', - 'broadcast_driver' => 'required|string|max:50', - 'cache_driver' => 'required|string|max:50', - 'session_driver' => 'required|string|max:50', - 'queue_driver' => 'required|string|max:50', - 'redis_hostname' => 'required|string|max:50', - 'redis_password' => 'required|string|max:50', - 'redis_port' => 'required|numeric', - 'mail_driver' => 'required|string|max:50', - 'mail_host' => 'required|string|max:50', - 'mail_port' => 'required|string|max:50', - 'mail_username' => 'required|string|max:50', - 'mail_password' => 'required|string|max:50', - 'mail_encryption' => 'required|string|max:50', - 'pusher_app_id' => 'max:50', - 'pusher_app_key' => 'max:50', - 'pusher_app_secret' => 'max:50', + 'app_name' => 'required|string|max:50', + 'environment' => 'required|string|max:50', + 'environment_custom' => 'required_if:environment,other|max:50', + 'app_debug' => 'required|string', + 'app_log_level' => 'required|string|max:50', + 'app_url' => 'required|url', + 'database_connection' => 'required|string|max:50', + 'database_hostname' => 'required|string|max:50', + 'database_port' => 'required|numeric', + 'database_name' => 'required|string|max:50', + 'database_username' => 'required|string|max:50', + 'database_password' => 'string|max:50|nullable', + 'broadcast_driver' => 'required|string|max:50', + 'cache_driver' => 'required|string|max:50', + 'session_driver' => 'required|string|max:50', + 'queue_driver' => 'required|string|max:50', + 'redis_hostname' => 'required|string|max:50', + 'redis_password' => 'required|string|max:50', + 'redis_port' => 'required|numeric', + 'mail_driver' => 'required|string|max:50', + 'mail_host' => 'required|string|max:50', + 'mail_port' => 'required|string|max:50', + 'mail_username' => 'required|string|max:50', + 'mail_password' => 'required|string|max:50', + 'mail_encryption' => 'required|string|max:50', + 'pusher_app_id' => 'max:50', + 'pusher_app_key' => 'max:50', + 'pusher_app_secret' => 'max:50', ], ], ], @@ -140,7 +140,7 @@ ], 'dump' => [ 'data' => 'Dumping a not found message.', - ] + ], ], ], diff --git a/config/lfm.php b/config/lfm.php index 08f10b780..7553d2d0e 100644 --- a/config/lfm.php +++ b/config/lfm.php @@ -36,7 +36,7 @@ |-------------------------------------------------------------------------- */ - 'use_package_routes' => true, + 'use_package_routes' => true, /* |-------------------------------------------------------------------------- @@ -47,18 +47,18 @@ | */ - 'allow_private_folder' => true, + 'allow_private_folder' => true, // Flexible way to customize client folders accessibility // If you want to customize client folders, publish tag="lfm_handler" // Then you can rewrite userField function in App\Handler\ConfigHandler class // And set 'user_field' to App\Handler\ConfigHandler::class // Ex: The private folder of user will be named as the user id. - 'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class, + 'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class, - 'allow_shared_folder' => true, + 'allow_shared_folder' => true, - 'shared_folder_name' => 'shares', + 'shared_folder_name' => 'shares', /* |-------------------------------------------------------------------------- @@ -66,15 +66,15 @@ |-------------------------------------------------------------------------- */ - 'folder_categories' => [ - 'file' => [ - 'folder_name' => 'files', + 'folder_categories' => [ + 'file' => [ + 'folder_name' => 'files', 'startup_view' => 'list', - 'max_size' => 50000, // size in KB + 'max_size' => 50000, // size in KB 'thumb' => true, 'thumb_width' => 80, 'thumb_height' => 80, - 'valid_mime' => [ + 'valid_mime' => [ 'image/jpeg', 'image/pjpeg', 'image/png', @@ -85,13 +85,13 @@ ], ], 'image' => [ - 'folder_name' => 'photos', + 'folder_name' => 'photos', 'startup_view' => 'grid', - 'max_size' => 50000, // size in KB + 'max_size' => 50000, // size in KB 'thumb' => true, 'thumb_width' => 80, 'thumb_height' => 80, - 'valid_mime' => [ + 'valid_mime' => [ 'image/jpeg', 'image/pjpeg', 'image/png', @@ -117,24 +117,24 @@ |-------------------------------------------------------------------------- */ - 'disk' => 'public', + 'disk' => 'public', - 'rename_file' => false, + 'rename_file' => false, - 'rename_duplicates' => false, + 'rename_duplicates' => false, - 'alphanumeric_filename' => false, + 'alphanumeric_filename' => false, - 'alphanumeric_directory' => false, + 'alphanumeric_directory' => false, - 'should_validate_size' => false, + 'should_validate_size' => false, - 'should_validate_mime' => true, + 'should_validate_mime' => true, // behavior on files with identical name // setting it to true cause old file replace with new one // setting it to false show `error-file-exist` error and stop upload - 'over_write_on_duplicate' => false, + 'over_write_on_duplicate' => false, // mimetypes of executables to prevent from uploading 'disallowed_mimetypes' => ['text/x-php', 'text/html', 'text/plain'], @@ -151,18 +151,18 @@ // If true, image thumbnails would be created during upload 'should_create_thumbnails' => true, - 'thumb_folder_name' => 'thumbs', + 'thumb_folder_name' => 'thumbs', // Create thumbnails automatically only for listed types. - 'raster_mimetypes' => [ + 'raster_mimetypes' => [ 'image/jpeg', 'image/pjpeg', 'image/png', ], - 'thumb_img_width' => 200, // px + 'thumb_img_width' => 200, // px - 'thumb_img_height' => 200, // px + 'thumb_img_height' => 200, // px /* |-------------------------------------------------------------------------- @@ -170,33 +170,33 @@ |-------------------------------------------------------------------------- */ - 'file_type_array' => [ - 'pdf' => 'Adobe Acrobat', - 'doc' => 'Microsoft Word', + 'file_type_array' => [ + 'pdf' => 'Adobe Acrobat', + 'doc' => 'Microsoft Word', 'docx' => 'Microsoft Word', - 'xls' => 'Microsoft Excel', + 'xls' => 'Microsoft Excel', 'xlsx' => 'Microsoft Excel', - 'zip' => 'Archive', - 'gif' => 'GIF Image', - 'jpg' => 'JPEG Image', + 'zip' => 'Archive', + 'gif' => 'GIF Image', + 'jpg' => 'JPEG Image', 'jpeg' => 'JPEG Image', - 'png' => 'PNG Image', - 'ppt' => 'Microsoft PowerPoint', + 'png' => 'PNG Image', + 'ppt' => 'Microsoft PowerPoint', 'pptx' => 'Microsoft PowerPoint', ], 'file_icon_array' => [ - 'pdf' => 'fa-file-pdf-o', - 'doc' => 'fa-file-word-o', + 'pdf' => 'fa-file-pdf-o', + 'doc' => 'fa-file-word-o', 'docx' => 'fa-file-word-o', - 'xls' => 'fa-file-excel-o', + 'xls' => 'fa-file-excel-o', 'xlsx' => 'fa-file-excel-o', - 'zip' => 'fa-file-archive-o', - 'gif' => 'fa-file-image-o', - 'jpg' => 'fa-file-image-o', + 'zip' => 'fa-file-archive-o', + 'gif' => 'fa-file-image-o', + 'jpg' => 'fa-file-image-o', 'jpeg' => 'fa-file-image-o', - 'png' => 'fa-file-image-o', - 'ppt' => 'fa-file-powerpoint-o', + 'png' => 'fa-file-image-o', + 'ppt' => 'fa-file-powerpoint-o', 'pptx' => 'fa-file-powerpoint-o', ], @@ -211,7 +211,7 @@ | Please note that the 'upload_max_filesize' & 'post_max_size' | directives are not supported. */ - 'php_ini_overrides' => [ + 'php_ini_overrides' => [ 'memory_limit' => '256M', ], ]; diff --git a/config/querydetector.php b/config/querydetector.php index 22a18edd4..fabc8715f 100644 --- a/config/querydetector.php +++ b/config/querydetector.php @@ -92,6 +92,6 @@ * \BeyondCode\QueryDetector\Outputs\Log::class */ 'output' => [ - \BeyondCode\QueryDetector\Outputs\Debugbar::class - ] + \BeyondCode\QueryDetector\Outputs\Debugbar::class, + ], ]; diff --git a/config/sentry.php b/config/sentry.php index b9b5863dc..7c5dcd0b2 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -31,7 +31,7 @@ return [ - 'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN', "https://c9484a1d294746c49f0fafc8fa86a804@o1345560.ingest.sentry.io/6622280")), + 'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN', 'https://c9484a1d294746c49f0fafc8fa86a804@o1345560.ingest.sentry.io/6622280')), // capture release as git sha // 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), @@ -79,7 +79,7 @@ // @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii 'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false), - 'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 1.0)), + 'traces_sample_rate' => (float) (env('SENTRY_TRACES_SAMPLE_RATE', 1.0)), 'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'), diff --git a/config/sluggable.php b/config/sluggable.php index 946a149e3..afe0ff4e4 100644 --- a/config/sluggable.php +++ b/config/sluggable.php @@ -46,7 +46,6 @@ * * Defaults to null, which uses the toString() method on your model. */ - 'source' => null, /** @@ -54,7 +53,6 @@ * no length restrictions are enforced. Set it to a positive integer if you * want to make sure your slugs aren't too long. */ - 'maxLength' => null, /** @@ -72,13 +70,11 @@ * * 'method' => array('Str','slug'), */ - 'method' => null, /** * Separator to use when generating slugs. Defaults to a hyphen. */ - 'separator' => '-', /** @@ -90,7 +86,6 @@ * my-slug-1 * my-slug-2 */ - 'unique' => true, /** @@ -101,7 +96,6 @@ * "similar" slugs. The closure should return the new unique * suffix to append to the slug. */ - 'uniqueSuffix' => null, /** @@ -110,7 +104,6 @@ * If set to "false", then a new slug could duplicate one that exists on a trashed model. * If set to "true", then uniqueness is enforced across trashed and existing models. */ - 'includeTrashed' => false, /** @@ -136,7 +129,6 @@ * * and continue from there. */ - 'reserved' => null, /** @@ -149,7 +141,6 @@ * is probably not a good idea from an SEO point of view. * Only set this to true if you understand the possible consequences. */ - 'onUpdate' => false, ]; diff --git a/config/themes-manager.php b/config/themes-manager.php new file mode 100644 index 000000000..05f84ea48 --- /dev/null +++ b/config/themes-manager.php @@ -0,0 +1,78 @@ + env('THEMES_DIR', 'themes'), + + /* + |-------------------------------------------------------------------------- + | Symbolic link path + |-------------------------------------------------------------------------- + | + | you can change the public themes path used for assets. + | + */ + 'symlink_path' => 'themes', + + /* + |-------------------------------------------------------------------------- + | Symbolic link relative + |-------------------------------------------------------------------------- + | + | Determine if relative symlink should be used instead of absolute one. + | + */ + 'symlink_relative' => false, + + /* + |-------------------------------------------------------------------------- + | Fallback Theme + |-------------------------------------------------------------------------- + | + | If you don't set a theme at runtime (through middleware for example) + | the fallback theme will be used automatically. + | + */ + 'fallback_theme' => null, + + /* + |-------------------------------------------------------------------------- + | Caching + |-------------------------------------------------------------------------- + | + | Config for caching feature. + | + */ + 'cache' => [ + 'enabled' => false, + 'key' => 'themes-manager', + 'lifetime' => 86400, + ], + + /* + |-------------------------------------------------------------------------- + | Composer File Template + |-------------------------------------------------------------------------- + | + | Config for composer.json file, generated for new theme + | If null then information will be asked at generation process + | If not null, values will be used at generation process + | + */ + 'composer' => [ + 'vendor' => null, + 'author' => [ + 'name' => null, + 'email' => null, + ], + ], +]; diff --git a/database/factories/ArtikelFactory.php b/database/factories/ArtikelFactory.php new file mode 100644 index 000000000..52eaef16b --- /dev/null +++ b/database/factories/ArtikelFactory.php @@ -0,0 +1,31 @@ + + */ +class ArtikelFactory extends Factory +{ + protected $model = Artikel::class; + + /** + * Define the model's default state. + * + * @return array'.$this->faker->name().'
', + 'status' => 'OPEN', + ]; + } +} diff --git a/database/factories/PengurusFactory.php b/database/factories/PengurusFactory.php new file mode 100644 index 000000000..f69cedea8 --- /dev/null +++ b/database/factories/PengurusFactory.php @@ -0,0 +1,47 @@ + + */ +class PengurusFactory extends Factory +{ + protected $model = Pengurus::class; + + /** + * Define the model's default state. + * + * @return arrayIni adalah kalimat visi
', - 'misi' => 'Ini adalah kalimat visi
', - 'created_at' => now(), - 'updated_at' => now(), + 'kepsek_pemberdayaan_masyarakat' => 'Asrarudin, SE', + 'kepsek_pelayanan_umum' => 'Masturi, ST', + 'kepsek_trantib' => 'Mastur Idris, SH', + 'file_struktur_organisasi' => null, + 'file_logo' => null, + 'visi' => 'Ini adalah kalimat visi
', + 'misi' => 'Ini adalah kalimat visi
', + 'created_at' => now(), + 'updated_at' => now(), ]); } } diff --git a/database/seeders/Demo/DemoDokumenSeeder.php b/database/seeders/Demo/DemoDokumenSeeder.php index aac5ae3f2..a4b1b00b6 100644 --- a/database/seeders/Demo/DemoDokumenSeeder.php +++ b/database/seeders/Demo/DemoDokumenSeeder.php @@ -43,13 +43,9 @@ class DemoDokumenSeeder extends Seeder */ public function run() { - $data = [ - [ - 'nama_dokumen' => 'Panduan OpenDK', - 'file_dokumen' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', - ], - ]; - - FormDokumen::insert($data); + FormDokumen::create([ + 'nama_dokumen' => 'Panduan OpenDK', + 'file_dokumen' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', + ]); } } diff --git a/database/seeders/Demo/DemoEpidemiPenyakitSeeder.php b/database/seeders/Demo/DemoEpidemiPenyakitSeeder.php index 22c50217a..c3afbb53e 100644 --- a/database/seeders/Demo/DemoEpidemiPenyakitSeeder.php +++ b/database/seeders/Demo/DemoEpidemiPenyakitSeeder.php @@ -48,8 +48,8 @@ public function run() Excel::import( new ImporEpidemiPenyakit([ 'penyakit_id' => JenisPenyakit::first()->id, - 'bulan' => now()->month, - 'tahun' => now()->year, + 'bulan' => now()->month, + 'tahun' => now()->year, ]), 'template_upload/Format_Upload_Epidemi_Penyakit.xlsx', 'public' diff --git a/database/seeders/Demo/DemoEventSeeder.php b/database/seeders/Demo/DemoEventSeeder.php index 8e3dcb35b..fb9b5375f 100644 --- a/database/seeders/Demo/DemoEventSeeder.php +++ b/database/seeders/Demo/DemoEventSeeder.php @@ -45,7 +45,7 @@ class DemoEventSeeder extends Seeder */ public function run() { - $faker = Factory::create("id-ID"); + $faker = Factory::create('id-ID'); foreach (range(1, 10) as $index) { $title = $faker->name(); @@ -56,7 +56,7 @@ public function run() 'start' => $faker->dateTime()->format('Y-m-d H:i:s'), 'end' => $faker->dateTime()->format('Y-m-d H:i:s'), 'attendants' => 'Camat', - 'description' => "" . $faker->name() . "
", + 'description' => ''.$faker->name().'
', 'status' => 'OPEN', ]); } diff --git a/database/seeders/Demo/DemoFaqSeeder.php b/database/seeders/Demo/DemoFaqSeeder.php index 644ac0062..70fbbf03e 100644 --- a/database/seeders/Demo/DemoFaqSeeder.php +++ b/database/seeders/Demo/DemoFaqSeeder.php @@ -52,6 +52,8 @@ public function run() ], ]; - Faq::insert($data); + foreach ($data as $faq) { + Faq::create($faq); + } } } diff --git a/database/seeders/Demo/DemoFasilitasPaudSeeder.php b/database/seeders/Demo/DemoFasilitasPaudSeeder.php index 6cdddb391..c61d55480 100644 --- a/database/seeders/Demo/DemoFasilitasPaudSeeder.php +++ b/database/seeders/Demo/DemoFasilitasPaudSeeder.php @@ -48,8 +48,8 @@ public function run() Excel::import( new ImporFasilitasPaud([ 'semester' => 1, - 'tahun' => now()->year, - 'desa_id' => DataDesa::first()->desa_id, + 'tahun' => now()->year, + 'desa_id' => DataDesa::first()->desa_id, ]), 'template_upload/Format_Upload_Fasilitas_PAUD.xlsx', 'public' diff --git a/database/seeders/Demo/DemoMediaSosialSeeder.php b/database/seeders/Demo/DemoMediaSosialSeeder.php index 71f510957..f834199b4 100644 --- a/database/seeders/Demo/DemoMediaSosialSeeder.php +++ b/database/seeders/Demo/DemoMediaSosialSeeder.php @@ -53,6 +53,8 @@ public function run() ], ]; - MediaSosial::insert($data); + foreach ($data as $media) { + MediaSosial::create($media); + } } } diff --git a/database/seeders/Demo/DemoPendudukKeluargaSeeder.php b/database/seeders/Demo/DemoPendudukKeluargaSeeder.php index ede6f7cbb..167e1e060 100644 --- a/database/seeders/Demo/DemoPendudukKeluargaSeeder.php +++ b/database/seeders/Demo/DemoPendudukKeluargaSeeder.php @@ -60,9 +60,10 @@ public function run() // Proses impor excell (new ImporPendudukKeluarga()) - ->queue($extract . Str::replaceLast('zip', 'xlsx', $name)); + ->queue($extract.Str::replaceLast('zip', 'xlsx', $name)); } catch (\Exception $e) { report($e); + return back()->with('error', 'Import data gagal.'); } } diff --git a/database/seeders/Demo/DemoPesanDetailSeeder.php b/database/seeders/Demo/DemoPesanDetailSeeder.php index 91071ef12..ac46bcdf0 100644 --- a/database/seeders/Demo/DemoPesanDetailSeeder.php +++ b/database/seeders/Demo/DemoPesanDetailSeeder.php @@ -47,19 +47,19 @@ class DemoPesanDetailSeeder extends Seeder public function run() { $defaultCounter = 150; - if (env("truncate", 0) === "1") { + if (env('truncate', 0) === '1') { Schema::disableForeignKeyConstraints(); - $this->command->info("truncating..."); + $this->command->info('truncating...'); DB::table('das_pesan_detail')->truncate(); Schema::enableForeignKeyConstraints(); } - $faker = Factory::create("id-ID"); + $faker = Factory::create('id-ID'); $pesan = Pesan::skip(0)->take(20); $pesan_id = $pesan->pluck('id'); for ($i = 1; $i <= $defaultCounter; $i++) { - DB::table("das_pesan_detail")->insert([ + DB::table('das_pesan_detail')->insert([ 'pesan_id' => $faker->randomElement($pesan_id), 'text' => $faker->text, 'pengirim' => 'desa', diff --git a/database/seeders/Demo/DemoPesanSeeder.php b/database/seeders/Demo/DemoPesanSeeder.php index 80de06c15..529df5a85 100644 --- a/database/seeders/Demo/DemoPesanSeeder.php +++ b/database/seeders/Demo/DemoPesanSeeder.php @@ -47,24 +47,24 @@ class DemoPesanSeeder extends Seeder public function run() { $defaultCounter = 50; - if (env("truncate", 0) === "1") { + if (env('truncate', 0) === '1') { Schema::disableForeignKeyConstraints(); - $this->command->info("truncating..."); + $this->command->info('truncating...'); DB::table('das_pesan')->truncate(); Schema::enableForeignKeyConstraints(); } - $faker = Factory::create("id-ID"); + $faker = Factory::create('id-ID'); $das_desa = DataDesa::skip(0)->take(20)->pluck('id'); - $sample_enum = ["Pesan Masuk", "Pesan Keluar"]; + $sample_enum = ['Pesan Masuk', 'Pesan Keluar']; for ($i = 1; $i <= $defaultCounter; $i++) { - DB::table("das_pesan")->insert([ + DB::table('das_pesan')->insert([ 'judul' => $faker->text(50), 'das_data_desa_id' => $faker->randomElement($das_desa), 'jenis' => $faker->randomElement($sample_enum), - 'sudah_dibaca' => $faker->randomElement([0,1]), - 'diarsipkan' => $faker->randomElement([0,1]), + 'sudah_dibaca' => $faker->randomElement([0, 1]), + 'diarsipkan' => $faker->randomElement([0, 1]), 'created_at' => $faker->dateTimeThisYear(), 'updated_at' => $faker->dateTimeThisYear(), ]); diff --git a/database/seeders/Demo/DemoPotensiSeeder.php b/database/seeders/Demo/DemoPotensiSeeder.php index f61a9730b..680244233 100644 --- a/database/seeders/Demo/DemoPotensiSeeder.php +++ b/database/seeders/Demo/DemoPotensiSeeder.php @@ -45,22 +45,26 @@ class DemoPotensiSeeder extends Seeder public function run() { $kategori = [ - ['nama_kategori' => 'Kategori 1', 'slug' => 'kategori-1'], - ['nama_kategori' => 'Kategori 2', 'slug' => 'kategori-2'], + ['nama_kategori' => 'Kategori 1'], + ['nama_kategori' => 'Kategori 2'], ]; - TipePotensi::insert($kategori); + foreach ($kategori as $k) { + TipePotensi::create($k); + } + + $kategori_id = TipePotensi::first()->id; $potensi = [ [ - 'kategori_id' => 1, + 'kategori_id' => $kategori_id, 'nama_potensi' => 'Potensi 1', 'deskripsi' => 'Deskripsi potensi 1', 'lokasi' => 'Lokasi potensi 1', 'file_gambar' => '/img/no-image.png', ], [ - 'kategori_id' => 1, + 'kategori_id' => $kategori_id, 'nama_potensi' => 'Potensi 2', 'deskripsi' => 'Deskripsi potensi 2', 'lokasi' => 'Lokasi potensi 2', @@ -68,6 +72,8 @@ public function run() ], ]; - Potensi::insert($potensi); + foreach ($potensi as $p) { + Potensi::create($p); + } } } diff --git a/database/seeders/Demo/DemoProgramBantuanSeeder.php b/database/seeders/Demo/DemoProgramBantuanSeeder.php index 257603c87..ee701b154 100644 --- a/database/seeders/Demo/DemoProgramBantuanSeeder.php +++ b/database/seeders/Demo/DemoProgramBantuanSeeder.php @@ -61,11 +61,12 @@ public function run() // Proses impor excell (new SinkronBantuan()) - ->queue($extract . Str::replaceLast('zip', 'csv', $name)); + ->queue($extract.Str::replaceLast('zip', 'csv', $name)); (new SinkronPesertaBantuan()) - ->queue($extract . Str::replaceLast('zip', 'csv', 'peserta_'.$name)); + ->queue($extract.Str::replaceLast('zip', 'csv', 'peserta_'.$name)); } catch (\Exception $e) { report($e); + return back()->with('error', 'Import data gagal.'); } } diff --git a/database/seeders/Demo/DemoProsedurSeeder.php b/database/seeders/Demo/DemoProsedurSeeder.php index b59e13def..c608933d5 100644 --- a/database/seeders/Demo/DemoProsedurSeeder.php +++ b/database/seeders/Demo/DemoProsedurSeeder.php @@ -46,18 +46,19 @@ public function run() $data = [ [ 'judul_prosedur' => 'Prosedur 1', - 'slug' => 'prosedur-1', 'file_prosedur' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', 'mime_type' => 'pdf', ], [ 'judul_prosedur' => 'Prosedur 2', - 'slug' => 'prosedur-2', 'file_prosedur' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', 'mime_type' => 'pdf', ], ]; - Prosedur::insert($data); + foreach ($data as $prosedur) { + Prosedur::create($prosedur); + } + } } diff --git a/database/seeders/Demo/DemoPutusSekolahSeeder.php b/database/seeders/Demo/DemoPutusSekolahSeeder.php index 48f38fbca..cb62fe171 100644 --- a/database/seeders/Demo/DemoPutusSekolahSeeder.php +++ b/database/seeders/Demo/DemoPutusSekolahSeeder.php @@ -48,8 +48,8 @@ public function run() Excel::import( new ImporPutusSekolah([ 'semester' => 1, - 'tahun' => now()->year, - 'desa_id' => DataDesa::first()->desa_id, + 'tahun' => now()->year, + 'desa_id' => DataDesa::first()->desa_id, ]), 'template_upload/Format_Upload_Putus_Sekolah.xlsx', 'public' diff --git a/database/seeders/Demo/DemoRegulasiSeeder.php b/database/seeders/Demo/DemoRegulasiSeeder.php index e0db35927..8f58c8470 100644 --- a/database/seeders/Demo/DemoRegulasiSeeder.php +++ b/database/seeders/Demo/DemoRegulasiSeeder.php @@ -31,7 +31,9 @@ namespace Database\Seeders\Demo; +use App\Models\Profil; use App\Models\Regulasi; +use App\Models\TipeRegulasi; use Illuminate\Database\Seeder; class DemoRegulasiSeeder extends Seeder @@ -43,18 +45,21 @@ class DemoRegulasiSeeder extends Seeder */ public function run() { + $profil_id = Profil::first()->id; + $tipe_regulasi = TipeRegulasi::first()->id; + $data = [ [ - 'profil_id' => 1, - 'tipe_regulasi' => 2, + 'profil_id' => $profil_id, + 'tipe_regulasi' => $tipe_regulasi, 'judul' => 'Regulasi 1', 'deskripsi' => 'Deskripsi regulasi 1', 'file_regulasi' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', 'mime_type' => 'pdf', ], [ - 'profil_id' => 1, - 'tipe_regulasi' => 2, + 'profil_id' => $profil_id, + 'tipe_regulasi' => $tipe_regulasi, 'judul' => 'Regulasi 2', 'deskripsi' => 'Deskripsi regulasi 2', 'file_regulasi' => 'storage/template_upload/Panduan_Pengguna_Kecamatan_Dashboard.pdf', @@ -62,6 +67,8 @@ public function run() ], ]; - Regulasi::insert($data); + foreach ($data as $regulasi) { + Regulasi::create($regulasi); + } } } diff --git a/database/seeders/Demo/DemoSinergiProgramSeeder.php b/database/seeders/Demo/DemoSinergiProgramSeeder.php index 385fbeb31..7acd5f753 100644 --- a/database/seeders/Demo/DemoSinergiProgramSeeder.php +++ b/database/seeders/Demo/DemoSinergiProgramSeeder.php @@ -54,6 +54,8 @@ public function run() ], ]; - SinergiProgram::insert($data); + foreach ($data as $program) { + SinergiProgram::create($program); + } } } diff --git a/database/seeders/Demo/DemoSliderSeeder.php b/database/seeders/Demo/DemoSliderSeeder.php index 5f3411d3b..3600cfe8e 100644 --- a/database/seeders/Demo/DemoSliderSeeder.php +++ b/database/seeders/Demo/DemoSliderSeeder.php @@ -66,6 +66,9 @@ public function run() ], ]; - Slide::insert($data); + foreach ($data as $slide) { + Slide::create($slide); + } + } } diff --git a/database/seeders/Demo/DemoTingkatPendidikanSeeder.php b/database/seeders/Demo/DemoTingkatPendidikanSeeder.php index a607b7506..63ac1f481 100644 --- a/database/seeders/Demo/DemoTingkatPendidikanSeeder.php +++ b/database/seeders/Demo/DemoTingkatPendidikanSeeder.php @@ -48,8 +48,8 @@ public function run() Excel::import( new ImporTingkatPendidikan([ 'semester' => 1, - 'tahun' => now()->year, - 'desa_id' => DataDesa::first()->desa_id, + 'tahun' => now()->year, + 'desa_id' => DataDesa::first()->desa_id, ]), 'template_upload/Format_Upload_Tingkat_Pendidikan.xlsx', 'public' diff --git a/database/seeders/DemoDatabaseSeeder.php b/database/seeders/DemoDatabaseSeeder.php index 92063482e..1d60aa10a 100644 --- a/database/seeders/DemoDatabaseSeeder.php +++ b/database/seeders/DemoDatabaseSeeder.php @@ -31,34 +31,35 @@ namespace Database\Seeders; +use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\DB; +use Database\Seeders\Demo\DemoFaqSeeder; +use Database\Seeders\Demo\DemoEventSeeder; +use Database\Seeders\Demo\DemoPesanSeeder; use Database\Seeders\Demo\DemoAKIAKBSeeder; -use Database\Seeders\Demo\DemoAnggaranRealisasiSeeder; +use Database\Seeders\Demo\DemoSliderSeeder; use Database\Seeders\Demo\DemoAPBDesaSeeder; use Database\Seeders\Demo\DemoArtikelSeeder; -use Database\Seeders\Demo\DemoDasDataDesaTableSeeder; -use Database\Seeders\Demo\DemoDasDataUmumTableSeeder; -use Database\Seeders\Demo\DemoDasPengurusTableSeeder; -use Database\Seeders\Demo\DemoDasProfilTableSeeder; use Database\Seeders\Demo\DemoDokumenSeeder; -use Database\Seeders\Demo\DemoEpidemiPenyakitSeeder; -use Database\Seeders\Demo\DemoEventSeeder; -use Database\Seeders\Demo\DemoFaqSeeder; -use Database\Seeders\Demo\DemoFasilitasPaudSeeder; +use Database\Seeders\Demo\DemoPotensiSeeder; +use Database\Seeders\Demo\DemoProsedurSeeder; +use Database\Seeders\Demo\DemoRegulasiSeeder; use Database\Seeders\Demo\DemoImunisasiSeeder; use Database\Seeders\Demo\DemoMediaSosialSeeder; -use Database\Seeders\Demo\DemoPendudukKeluargaSeeder; use Database\Seeders\Demo\DemoPesanDetailSeeder; -use Database\Seeders\Demo\DemoPesanSeeder; -use Database\Seeders\Demo\DemoPotensiSeeder; -use Database\Seeders\Demo\DemoProgramBantuanSeeder; -use Database\Seeders\Demo\DemoProsedurSeeder; use Database\Seeders\Demo\DemoPutusSekolahSeeder; -use Database\Seeders\Demo\DemoRegulasiSeeder; +use Database\Seeders\Demo\DemoFasilitasPaudSeeder; +use Database\Seeders\Demo\DemoDasProfilTableSeeder; +use Database\Seeders\Demo\DemoProgramBantuanSeeder; use Database\Seeders\Demo\DemoSinergiProgramSeeder; -use Database\Seeders\Demo\DemoSliderSeeder; -use Database\Seeders\Demo\DemoTingkatPendidikanSeeder; use Database\Seeders\Demo\DemoToiletSanitasiSeeder; -use Illuminate\Database\Seeder; +use Database\Seeders\Demo\DemoEpidemiPenyakitSeeder; +use Database\Seeders\Demo\DemoDasDataDesaTableSeeder; +use Database\Seeders\Demo\DemoDasDataUmumTableSeeder; +use Database\Seeders\Demo\DemoDasPengurusTableSeeder; +use Database\Seeders\Demo\DemoPendudukKeluargaSeeder; +use Database\Seeders\Demo\DemoAnggaranRealisasiSeeder; +use Database\Seeders\Demo\DemoTingkatPendidikanSeeder; class DemoDatabaseSeeder extends Seeder { @@ -69,6 +70,8 @@ class DemoDatabaseSeeder extends Seeder */ public function run() { + DB::statement('SET FOREIGN_KEY_CHECKS=0;'); + $this->call(DatabaseSeeder::class); $this->call(DemoDasProfilTableSeeder::class); @@ -99,5 +102,7 @@ public function run() $this->call(DemoMediaSosialSeeder::class); $this->call(DemoSinergiProgramSeeder::class); $this->call(DemoSliderSeeder::class); + + DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } } diff --git a/database/seeders/RefCoaTableSeeder.php b/database/seeders/RefCoaTableSeeder.php index e454a6728..f68bbc079 100644 --- a/database/seeders/RefCoaTableSeeder.php +++ b/database/seeders/RefCoaTableSeeder.php @@ -373,7 +373,7 @@ public function run() 'type_id' => 5, 'sub_id' => 2, 'sub_sub_id' => 1, - 'coa_name' => 'Belanja Perlengkapan Barang Konsumsi (Makan/minum) - Belanja Barang Konsumsi', + 'coa_name' => 'Belanja Perlengkapan Barang Konsumsi (Makan/minum) - Belanja Barang Konsumsi', ], 47 => [ 'id' => '07', @@ -625,7 +625,7 @@ public function run() 'type_id' => 5, 'sub_id' => 2, 'sub_sub_id' => 6, - 'coa_name' => 'Belanja Pemeliharaan Jaringan dan Instalasi (Listrik, Telepon, Internet, Komunikasi, dll)', + 'coa_name' => 'Belanja Pemeliharaan Jaringan dan Instalasi (Listrik, Telepon, Internet, Komunikasi, dll)', ], 83 => [ 'id' => '90-99', diff --git a/database/seeders/RefPekerjaanTableSeeder.php b/database/seeders/RefPekerjaanTableSeeder.php index 6c9a967b7..529527c9a 100644 --- a/database/seeders/RefPekerjaanTableSeeder.php +++ b/database/seeders/RefPekerjaanTableSeeder.php @@ -64,15 +64,15 @@ public function run() ], 4 => [ 'id' => 5, - 'nama' => 'PEGAWAI NEGERI SIPIL (PNS)', + 'nama' => 'PEGAWAI NEGERI SIPIL (PNS)', ], 5 => [ 'id' => 6, - 'nama' => 'TENTARA NASIONAL INDONESIA (TNI)', + 'nama' => 'TENTARA NASIONAL INDONESIA (TNI)', ], 6 => [ 'id' => 7, - 'nama' => 'KEPOLISIAN RI (POLRI)', + 'nama' => 'KEPOLISIAN RI (POLRI)', ], 7 => [ 'id' => 8, diff --git a/database/seeders/RoleSpatieSeeder.php b/database/seeders/RoleSpatieSeeder.php index 9b62f56d8..c456e2ca9 100644 --- a/database/seeders/RoleSpatieSeeder.php +++ b/database/seeders/RoleSpatieSeeder.php @@ -46,12 +46,12 @@ class RoleSpatieSeeder extends Seeder */ public function run() { - DB::statement("SET foreign_key_checks=0"); + DB::statement('SET foreign_key_checks=0'); DB::table('roles')->truncate(); DB::table('permissions')->truncate(); DB::table('role_has_permissions')->truncate(); DB::table('model_has_roles')->truncate(); - DB::statement("SET foreign_key_checks=1"); + DB::statement('SET foreign_key_checks=1'); // DB::table('roles')->truncate(); app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions(); @@ -62,7 +62,7 @@ public function run() Permission::create(['name' => 'edit', 'guard_name' => 'web']); Permission::create(['name' => 'delete', 'guard_name' => 'web']); - $role_admin = Role::create(['name' => 'super-admin', 'guard_name' => 'web'])->givePermissionTo(['view', 'create', 'edit', 'delete']); + $role_admin = Role::create(['name' => 'super-admin', 'guard_name' => 'web'])->givePermissionTo(['view', 'create', 'edit', 'delete']); // cek user admin $user = User::where('email', 'admin@mail.com')->first(); diff --git a/helpers/general_helper.php b/helpers/general_helper.php index 02c0a2ec8..17d1a232c 100644 --- a/helpers/general_helper.php +++ b/helpers/general_helper.php @@ -37,10 +37,10 @@ /** * Parsing url image dari rss feed description * - * @param string $content + * @param string $content * @return string */ -if (!function_exists('get_tag_image')) { +if (! function_exists('get_tag_image')) { function get_tag_image(string $content) { if (preg_match('/+------------------------------------------------------------------------------------------- CKEditor - Posted Data @@ -13,4 +14,4 @@ For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license ------------------------------------------------------------------------------------------- -