From 5b25a464baaac601bca951bef9873e20cbab0220 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 12 Dec 2017 14:48:03 -0600 Subject: [PATCH] Rename the PilotService to UserService --- .../Controllers/Auth/RegisterController.php | 25 ++++++------------- app/Services/PIREPService.php | 4 +-- .../{PilotService.php => UserService.php} | 2 +- composer.lock | 8 +++--- 4 files changed, 15 insertions(+), 24 deletions(-) rename app/Services/{PilotService.php => UserService.php} (98%) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 09cfd8fd..57629e23 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -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; diff --git a/app/Services/PIREPService.php b/app/Services/PIREPService.php index d854e022..f1a5cd44 100644 --- a/app/Services/PIREPService.php +++ b/app/Services/PIREPService.php @@ -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; diff --git a/app/Services/PilotService.php b/app/Services/UserService.php similarity index 98% rename from app/Services/PilotService.php rename to app/Services/UserService.php index e645b0b4..ba511bd4 100644 --- a/app/Services/PilotService.php +++ b/app/Services/UserService.php @@ -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 diff --git a/composer.lock b/composer.lock index ece13d7d..be9bbae3 100644 --- a/composer.lock +++ b/composer.lock @@ -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",