<?php

namespace App\Services;

use App\Models\User;
use Illuminate\Support\Facades\Gate;

class UserService
{

    public function __construct(protected User $user) {}
    public function createUser(array $user)
    {
        if (User::where('email', '=', $user['email'])) {
            throw new \Exception('O e-mail já está cadastrado.');
        }

        return User::create($user);
    }
}
