Add HR resource labels and helper methods for various resources; update locale handling in user model and department factory
This commit is contained in:
25
app/Helpers/helpers.php
Normal file
25
app/Helpers/helpers.php
Normal 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(),
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user