Files
SAE-BUT2-backend/app/Services/UserService.php
T

32 lines
953 B
PHP

<?php
namespace App\Services;
use App\Models\User;
use Illuminate\Support\Facades\Log;
class UserService
{
public static function getData(int $id) : array {
$user = User::findOrFail($id);
return [
"id" => $user->id,
"name" => $user->name,
"lastname" => $user->lastname,
"email" => $user->email,
"role" => GetRole::getRole($user->role),
"isAdmin" => ($user->role === 1 || $user->role === 2),
"phone" => $user->phone,
"created_at" => $user->created_at,
"updated_at" => $user->updated_at,
"verfied_at" => $user->verfied_at,
"validate" => $user->validate,
"tasks" => $user->tasks,
"profile_photo_path" => $user->profile_photo_path,
"email_notifications" => $user->email_notifications,
"web_notifications" => $user->web_notifications,
];
}
}