Last active
August 5, 2019 15:00
-
-
Save fhulufhelo/06730947648144300e47b25a8cd715b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\RegisterUser; | |
use App\User; | |
use Illuminate\Support\Facades\Hash; | |
use Illuminate\Http\Request; | |
abstract class Registering | |
{ | |
/** | |
* any inherited must create with this methods | |
* @return \App\User | |
* | |
* @throws \Illuminate\Auth\Access\AuthorizationException | |
*/ | |
abstract function handle(Request $request); | |
/** | |
* Handle a registration request for the application. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return \Illuminate\Http\Response | |
*/ | |
public function register(Request $request) | |
{ | |
return $this->create($request->all()); | |
} | |
/** | |
* Create a new user instance. | |
* | |
* @param array $data | |
* @return \App\User | |
*/ | |
protected function create(array $data) | |
{ | |
return User::create([ | |
'name' => $data['name'], | |
'email' => $data['email'], | |
'password' => Hash::make($data['password']), | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment