Allow user to set country
This commit is contained in:
@@ -21,6 +21,7 @@ class CreateUsersTable extends Migration
|
||||
$table->string('api_key', 40)->nullable();
|
||||
$table->unsignedInteger('airline_id');
|
||||
$table->unsignedInteger('rank_id')->nullable();
|
||||
$table->string('country', 2)->nullable();
|
||||
$table->string('home_airport_id', 5)->nullable();
|
||||
$table->string('curr_airport_id', 5)->nullable();
|
||||
$table->string('last_pirep_id', 12)->nullable();
|
||||
|
||||
@@ -16,6 +16,7 @@ users:
|
||||
api_key: testadminapikey
|
||||
airline_id: 1
|
||||
rank_id: 1
|
||||
country: us
|
||||
home_airport_id: KAUS
|
||||
curr_airport_id: KJFK
|
||||
last_pirep_id: pirepid_3
|
||||
|
||||
@@ -136,9 +136,15 @@ class UserController extends BaseController
|
||||
->whereOrder(['user_id' => $id], 'created_at', 'desc')
|
||||
->paginate();
|
||||
|
||||
$countries = collect((new \League\ISO3166\ISO3166)->all())
|
||||
->mapWithKeys(function ($item, $key) {
|
||||
return [strtolower($item['alpha2']) => $item['name']];
|
||||
});
|
||||
|
||||
return view('admin.users.edit', [
|
||||
'user' => $user,
|
||||
'pireps' => $pireps,
|
||||
'countries' => $countries,
|
||||
'timezones' => Timezonelist::toArray(),
|
||||
'airports' => Airport::all()->pluck('icao', 'id'),
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
|
||||
@@ -73,10 +73,16 @@ class ProfileController extends AppBaseController
|
||||
$airlines = $this->airlineRepo->selectBoxList();
|
||||
$airports = $this->airportRepo->selectBoxList();
|
||||
|
||||
$countries = collect((new \League\ISO3166\ISO3166)->all())
|
||||
->mapWithKeys(function($item, $key) {
|
||||
return [strtolower($item['alpha2']) => $item['name']];
|
||||
});
|
||||
|
||||
return $this->view('profile.edit', [
|
||||
'user' => $user,
|
||||
'airlines' => $airlines,
|
||||
'airports' => $airports,
|
||||
'countries' => $countries,
|
||||
'timezones' => Timezonelist::toArray(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class User extends Authenticatable
|
||||
'airline_id',
|
||||
'rank_id',
|
||||
'api_key',
|
||||
'country',
|
||||
'home_airport_id',
|
||||
'curr_airport_id',
|
||||
'last_pirep_id',
|
||||
|
||||
Reference in New Issue
Block a user