feat: inisialisasi project kit v2

This commit is contained in:
2026-05-21 15:57:29 +07:00
commit d4fd478e1f
271 changed files with 35300 additions and 0 deletions
@@ -0,0 +1,65 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{
/**
* The root template that is loaded on the first page visit.
*
* @var string
*/
protected $rootView = 'app';
/**
* Determine the current asset version.
*/
public function version(Request $request): ?string
{
return parent::version($request);
}
/**
* Define the props that are shared by default.
*
* @return array<string, mixed>
*/
public function share(Request $request): array
{
$settings = \Illuminate\Support\Facades\Cache::rememberForever('system_settings', function() {
return \App\Models\Setting::pluck('value', 'key')->toArray();
});
// Inject default defaults if not in DB
$defaultSettings = [
'app_name' => 'biiskit',
'app_logo' => null,
'app_logo_text' => 'B',
'allow_registration' => '1',
];
$settings = array_merge($defaultSettings, $settings);
return [
...parent::share($request),
'auth' => [
'user' => $request->user(),
'permissions' => $request->user()?->getAllPermissions()->pluck('name') ?? [],
'roles' => $request->user()?->getRoleNames() ?? [],
],
'system_settings' => $settings,
'unread_notifications' => $request->user()
? \App\Models\NotificationLog::where('status', 'sent')
->where('created_at', '>=', now()->subDays(7))
->count()
: 0,
'flash' => [
'success' => $request->session()->get('success'),
'error' => $request->session()->get('error'),
'plain_text_token' => $request->session()->get('plain_text_token'),
],
];
}
}