Get rid of ability to change currency in preferences and update RegisterController to set currency of space instead of user
MODIFY
app/Http/Controllers/RegisterController.php
app/Http/Controllers/RegisterController.php
@@ -34,13 +34,13 @@ class RegisterController extends Controller {
$user->email = $request->email;
$user->password = Hash::make($request->password);
$user->verification_token = str_random(100);
- $user->currency_id = $request->currency;
$user->save();
// Space
$space = new Space;
+ $space->currency_id = $request->currency;
$space->name = $user->name . '\'s Space';
$space->save();

MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -23,8 +23,7 @@ class SettingsController extends Controller {
'password' => 'nullable|confirmed',
'language' => 'nullable|in:' . implode(',', array_keys(config('app.locales'))),
'theme' => 'nullable|in:light,dark',
- 'weekly_report' => 'nullable|in:true,false',
- 'currency' => 'nullable|exists:currencies,id'
+ 'weekly_report' => 'nullable|in:true,false'
]);
$user = Auth::user();
@@ -65,10 +64,6 @@ class SettingsController extends Controller {
$user->theme = $request->input('theme');
}
- if ($request->has('currency')) {
- $user->currency_id = $request->input('currency');
- }
-
if ($request->has('weekly_report')) {
$user->weekly_report = $request->input('weekly_report') == 'true' ? true : false;
}
@@ -99,8 +94,7 @@ class SettingsController extends Controller {
public function getPreferences() {
return view('settings.preferences', [
- 'languages' => config('app.locales'),
- 'currencies' => Currency::all()
+ 'languages' => config('app.locales')
]);
}
}

MODIFY
resources/views/settings/preferences.blade.php
resources/views/settings/preferences.blade.php
</select>
@include('partials.validation_error', ['payload' => 'theme'])
</div>
- <div class="input input--small">
- <label>{{ __('fields.currency') }}</label>
- <select name="currency">
- @foreach ($currencies as $currency)
- <option value="{{ $currency->id }}" {{ Auth::user()->currency_id == $currency->id ? 'selected' : '' }}>{!! $currency->symbol !!} &middot; {{ $currency->name }}</option>
- @endforeach
- </select>
- @include('partials.validation_error', ['payload' => 'currency'])
- </div>
<div class="input input--small">
<label>{{ __('fields.weekly_report') }}</label>
<div>

Get rid of ability to change currency in preferences and update RegisterController to set currency of space instead of user