Rename the PilotService to UserService

This commit is contained in:
Nabeel Shahzad 2017-12-12 14:48:03 -06:00
parent a5cf130176
commit 5b25a464ba
4 changed files with 15 additions and 24 deletions

View File

@ -5,24 +5,13 @@ namespace App\Http\Controllers\Auth;
use Validator;
use App\Models\Airport;
use App\Models\Airline;
use App\Services\PilotService;
use App\Services\UserService;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
@ -32,6 +21,8 @@ class RegisterController extends Controller
*/
protected $redirectTo = '/';
protected $userService;
public function showRegistrationForm()
{
$airports = Airport::all();
@ -47,8 +38,11 @@ class RegisterController extends Controller
*
* @return void
*/
public function __construct()
public function __construct(
UserService $userService
)
{
$this->userService = $userService;
$this->middleware('guest');
}
@ -86,11 +80,8 @@ class RegisterController extends Controller
'password' => 'required|confirmed'
]);
# Let's call the service
$pilotService = app('App\Services\PilotService');
# Let's tell the service to create the pilot
if($p = $pilotService->createPilot($data))
if($p = $this->userService->createPilot($data))
{
//return $this->view('auth.registered');
return $p;

View File

@ -19,11 +19,11 @@ class PIREPService extends BaseService
/**
* PIREPService constructor.
* @param PilotService $pilotSvc
* @param UserService $pilotSvc
* @param PirepRepository $pirepRepo
*/
public function __construct(
PilotService $pilotSvc,
UserService $pilotSvc,
PirepRepository $pirepRepo
) {
$this->pilotSvc = $pilotSvc;

View File

@ -12,7 +12,7 @@ use App\Events\UserStateChanged;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
class PilotService extends BaseService
class UserService extends BaseService
{
public function adjustFlightCount(User &$pilot, int $count): User

8
composer.lock generated
View File

@ -2093,12 +2093,12 @@
"source": {
"type": "git",
"url": "https://github.com/nabeelio/LaravelInstaller.git",
"reference": "c695fb559ddd05290f6898d284abe71a83d25b95"
"reference": "0a5877b5550b0f8b35ed354331f1250747c9c223"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nabeelio/LaravelInstaller/zipball/c695fb559ddd05290f6898d284abe71a83d25b95",
"reference": "c695fb559ddd05290f6898d284abe71a83d25b95",
"url": "https://api.github.com/repos/nabeelio/LaravelInstaller/zipball/0a5877b5550b0f8b35ed354331f1250747c9c223",
"reference": "0a5877b5550b0f8b35ed354331f1250747c9c223",
"shasum": ""
},
"require": {
@ -2135,7 +2135,7 @@
}
],
"description": "Laravel web installer",
"time": "2017-12-04T19:05:57+00:00"
"time": "2017-12-04T21:21:14+00:00"
},
{
"name": "nabeel/vacentral",