Add HR resource labels and helper methods for various resources; update locale handling in user model and department factory

This commit is contained in:
Mekan1206
2026-07-31 23:40:35 +05:00
parent 581cb8241c
commit 20d032c4cc
83 changed files with 4386 additions and 39 deletions

25
app/Helpers/helpers.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* User function, returns user, if there is no user, returns empty User class
*/
function user(): User|null
{
return Auth::user() ?? new User([
'locale' => config('hr.default_locale'),
'name' => 'Guest',
'email' => 'guest@example.com',
'password' => Hash::make('password'),
'email_verified_at' => now(),
'remember_token' => Str::random(10),
'created_at' => now(),
'updated_at' => now(),
]);
}