Skip to content

Commit

Permalink
Merge pull request #223 from OpenSID/issue218-dasbor
Browse files Browse the repository at this point in the history
penamaan sambutan pada dasbor
  • Loading branch information
vickyrolanda authored Jul 5, 2023
2 parents 1a23041 + a781b5b commit b8bed8b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/Http/Controllers/DasborController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

namespace App\Http\Controllers;

use App\Models\Identitas;

class DasborController extends Controller
{
public function index()
{
return view('dasbor.index');
$identitas = new Identitas();
$data = $identitas->pengaturan();

return view('dasbor.index', compact('data'));
}
}
20 changes: 20 additions & 0 deletions app/Models/Identitas.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,24 @@
class Identitas extends Model
{
use HasFactory;

protected $table = "identitas";

protected $fillable = [
"nama_aplikasi", "deskripsi", "favicon",
"logo", "nama_kabupaten", "kode_kabupaten",
"nama_provinsi", "kode_provinsi", "sebutan_kab"
];

public static function pengaturan()
{
$identitas = self::first();

$data['nama_aplikasi'] = $identitas->nama_aplikasi ?? config('app.namaAplikasi');
$data['sebutanKab'] = $identitas->sebutan_kab ?? config('app.sebutanKab');
$nama_kabupaten = preg_replace("/KAB/", "", $identitas->nama_kabupaten) ?? config('app.namaKab');
$data['nama_kabupaten'] = strtolower($data['sebutanKab']) == 'kota' ? $nama_kabupaten : $data['sebutanKab'] . ' ' . $nama_kabupaten;

return $data;
}
}
2 changes: 1 addition & 1 deletion resources/views/dasbor/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@section('content')
<x-adminlte-callout theme="warning">
Selamat datang <b>{{ Auth::user()->username ?? '' }}</b> di Dasbor Utama
<b>{{ config('app.namaAplikasi') . ' ' . config('app.sebutanKab') . ' ' . config('app.namaKab') }}</b>.
<b>{{ ucwords(strtolower($data['nama_aplikasi'])) . ' ' . ucwords(strtolower($data['nama_kabupaten'])) }}</b>.
</x-adminlte-callout>

<div class="row">
Expand Down

0 comments on commit b8bed8b

Please sign in to comment.