Add store function to SettingsController
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
class SettingsController extends Controller {
public function index() {
return view('settings');
}
+
+ public function store(Request $request) {
+ $user = Auth::user();
+
+ $user->name = $request->input('name');
+ $user->email = $request->input('email');
+
+ $user->save();
+
+ return redirect()->route('settings_get');
+ }
}

MODIFY
public/style.css
public/style.css
@@ -63,7 +63,7 @@ input {
font: inherit;
}
-input[type=email], input[type=password] {
+input[type=text], input[type=email], input[type=password] {
margin-bottom: 16px;
padding: 8px;
width: 100%;
@@ -71,7 +71,7 @@ input[type=email], input[type=password] {
border-radius: 3px;
}
-input[type=email]:focus, input[type=password]:focus {
+input[type=text]:focus, input[type=email]:focus, input[type=password]:focus {
outline: 0;
border-color: #2071F8;
}

MODIFY
resources/views/settings.blade.php
resources/views/settings.blade.php
<h1>Settings</h1>
<div class="box">
<div class="box__section">
- <p>Lorem ipsum</p>
+ <form method="POST">
+ {{ csrf_field() }}
+ <label>Name</label>
+ <input type="text" name="name" value="{{ Auth::user()->name }}" />
+ <label>E-mail</label>
+ <input type="email" name="email" value="{{ Auth::user()->email }}" />
+ <input type="submit" value="Update" />
+ </form>
</div>
</div>
@endsection

MODIFY
routes/web.php
routes/web.php
@@ -7,6 +7,7 @@ Route::group(['middleware' => ['auth']], function () {
Route::get('/dashboard', 'DashboardController@index')->name('dashboard_get');
Route::get('/settings', 'SettingsController@index')->name('settings_get');
+ Route::post('/settings', 'SettingsController@store')->name('settings_post');
});
Route::get('/logout', 'LogoutController@index')->name('logout_get');

Add store function to SettingsController