<?php

namespace App\Services\Admin\Auth;
use App\Services\BaseService;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;

class RegisterService extends BaseService
{
    public function signup(array $data){
        $user = new User();
        $user->name         = $data['name'];
        $user->email       = $data['email'];
        $user->type       = $data['type'];
        $user->password       = Hash::make($data['password']);
        $user->save();

//        $user = User::create([
//            'name' => $data['name'],
//            'email' => $data['email'],
//            'user_type' => $data['type'],
//            'password' => Hash::make($data['password'])
//        ]);
//        $user->sendEmailVerificationNotification();
//        event(new Registered($user));
        $this->guard()->login($user);

//        return $this->registered($request, $user)
//            ?: redirect($this->redirectPath());
    }

    protected function guard()
    {
        return Auth::guard();
    }
}
