Add a setting for the admin email and set an initial value after the install

This commit is contained in:
Nabeel Shahzad
2017-12-30 20:27:12 -06:00
parent 7180bfb111
commit 2323330444
2 changed files with 20 additions and 4 deletions

View File

@@ -22,8 +22,10 @@ class CreateSettingsTable extends Migration
$table->string('type')->nullable();
$table->string('options')->nullable();
$table->string('description')->nullable();
$table->timestamps();
$table->unique('key');
$table->index('key');
});
/**
@@ -41,6 +43,15 @@ class CreateSettingsTable extends Migration
],
[
'order' => 2,
'name' => 'Admin Email',
'group' => 'general',
'key' => 'general.admin_email',
'value' => '',
'type' => 'text',
'description' => 'Email where notices, etc are sent',
],
[
'order' => 3,
'name' => 'Currency to Use',
'group' => 'general',
'key' => 'general.currency',

View File

@@ -2,16 +2,17 @@
namespace Modules\Installer\Http\Controllers;
use App\Models\User;
use App\Repositories\AirlineRepository;
use Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Validator;
use App\Models\User;
use App\Models\Setting;
use App\Repositories\AirlineRepository;
use App\Facades\Utils;
use App\Services\UserService;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\AppBaseController;
use Modules\Installer\Services\DatabaseService;
@@ -255,9 +256,13 @@ class InstallerController extends AppBaseController
$user = User::create($attrs);
$user = $this->userService->createPilot($user, ['admin']);
Log::info('User registered: ', $user->toArray());
# Set the intial admin e-mail address
$admin_email = Setting::where('key', 'general.admin_email');
$admin_email->value = $user->email;
$admin_email->save();
return view('installer::steps/step3a-completed', []);
}