diff --git a/Procfile b/Procfile index 1729d537..dd368790 100644 --- a/Procfile +++ b/Procfile @@ -1,5 +1,5 @@ dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground php-fpm: /usr/local/sbin/php-fpm --nodaemonize nginx: /usr/local/bin/nginx -mysql: /usr/local/bin/mysqld +#mysql: /usr/local/bin/mysqld mailhog: /usr/local/bin/mailhog diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 68ada101..2040b4da 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,18 +2,21 @@ namespace App\Http\Controllers\Auth; -use App\Models\Enums\PilotState; use Log; -use App\Facades\Utils; -use App\Models\User; -use Illuminate\Support\Facades\Hash; use Validator; +use Illuminate\Support\Facades\Hash; +use Illuminate\Foundation\Auth\RegistersUsers; +use Illuminate\Http\Request; + +use App\Models\User; +use App\Facades\Utils; use App\Models\Airport; use App\Models\Airline; use App\Services\UserService; +use App\Models\Enums\PilotState; use App\Http\Controllers\Controller; -use Illuminate\Foundation\Auth\RegistersUsers; -use Illuminate\Http\Request; +use App\Repositories\AirlineRepository; +use App\Repositories\AirportRepository; class RegisterController extends Controller { @@ -26,20 +29,27 @@ class RegisterController extends Controller */ protected $redirectTo = '/'; - protected $userService; + protected $airlineRepo, + $airportRepo, + $userService; public function __construct( + AirlineRepository $airlineRepo, + AirportRepository $airportRepo, UserService $userService ) { + $this->airlineRepo = $airlineRepo; + $this->airportRepo = $airportRepo; $this->userService = $userService; $this->middleware('guest'); } public function showRegistrationForm() { - $airports = Airport::all(); - $airlines = Airline::all(); + $airports = $this->airportRepo->selectBoxList(); + $airlines = $this->airlineRepo->selectBoxList(); + return $this->view('auth.register', [ 'airports' => $airports, 'airlines' => $airlines, @@ -57,8 +67,8 @@ class RegisterController extends Controller return Validator::make($data, [ 'name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', - 'airline' => 'required', - 'home_airport' => 'required', + 'airline_id' => 'required', + 'home_airport_id' => 'required', 'password' => 'required|min:5|confirmed', ]); } @@ -76,9 +86,9 @@ class RegisterController extends Controller 'name' => $data['name'], 'email' => $data['email'], 'api_key' => Utils::generateApiKey(), - 'airline_id' => $data['airline'], - 'home_airport_id' => $data['home_airport'], - 'curr_airport_id' => $data['home_airport'], + 'airline_id' => $data['airline_id'], + 'home_airport_id' => $data['home_airport_id'], + 'curr_airport_id' => $data['home_airport_id'], 'password' => Hash::make($data['password']) ]; @@ -99,8 +109,8 @@ class RegisterController extends Controller $this->validate(request(), [ 'name' => 'required', 'email' => 'required|unique:users|email', - 'airline' => 'required', - 'home_airport' => 'required', + 'airline_id' => 'required', + 'home_airport_id' => 'required', 'password' => 'required|confirmed' ]); diff --git a/resources/views/layouts/default/auth/register.blade.php b/resources/views/layouts/default/auth/register.blade.php index df18a1cd..a0978ead 100644 --- a/resources/views/layouts/default/auth/register.blade.php +++ b/resources/views/layouts/default/auth/register.blade.php @@ -2,70 +2,67 @@ @section('title', 'register') @section('content')