Add RegisterController
ADD
app/Http/Controllers/RegisterController.php
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+
+use App\Currency;
+use App\User;
+use Hash;
+
+class RegisterController extends Controller {
+ public function index() {
+ $currencies = Currency::all();
+
+ return view('register.index', compact('currencies'));
+ }
+
+ public function store(Request $request) {
+ $user = new User;
+
+ $user->name = $request->name;
+ $user->email = $request->email;
+ $user->password = Hash::make($request->password);
+ $user->currency_id = $request->currency;
+
+ $user->save();
+
+ return redirect('/register');
+ }
+}

MODIFY
resources/views/login/index.blade.php
resources/views/login/index.blade.php
<input type="email" name="email" />
<label>Password</label>
<input type="password" name="password" />
+ <div class="row tight">
+ <div class="column">
<input type="submit" value="Log in" />
+ </div>
+ <div class="column align-middle">
+ <a href="/register">Register</a>
+ </div>
+ </div>
</form>
</div>
</div>

ADD
resources/views/register/index.blade.php
+@extends('layout')
+
+@section('body')
+ <div class="row">
+ <div class="column size-560 align-center">
+ <h1 class="spacing-bottom-large">Register</h1>
+ <div class="box spacing-small">
+ <form method="POST">
+ {{ csrf_field() }}
+ <label>Name</label>
+ <input type="text" name="name" />
+ <label>E-mail</label>
+ <input type="email" name="email" />
+ <label>Password</label>
+ <input type="password" name="password" />
+ <label>Currency</label>
+ <select name="currency">
+ @foreach ($currencies as $currency)
+ <option value="{{ $currency->id }}">{{ $currency->symbol }} &middot; {{ $currency->name }}</option>
+ @endforeach
+ </select>
+ <div class="row tight">
+ <div class="column">
+ <input type="submit" value="Register" />
+ </div>
+ <div class="column align-middle">
+ <a href="/login">Log in</a>
+ </div>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+@endsection

MODIFY
routes/web.php
routes/web.php
Route::get('/login', 'LoginController@index')->name('login.index');
Route::post('/login', 'LoginController@store')->name('login.store');
+Route::get('/register', 'RegisterController@index');
+Route::post('/register', 'RegisterController@store');
+
Route::group(['middleware' => ['auth']], function () {
Route::get('/dashboard', 'DashboardController@index')->name('dashboard.index');

Add RegisterController