2015-06-19 16:50:05 +00:00
|
|
|
<?php
|
|
|
|
|
2015-06-23 14:24:49 +00:00
|
|
|
// todo: move to controllers
|
|
|
|
use Gwent\User;
|
|
|
|
use Illuminate\Support\Facades\Request;
|
|
|
|
|
|
|
|
Route::group(['prefix' => 'api'], function() {
|
|
|
|
|
|
|
|
post('/register', function() {
|
|
|
|
$user = new User();
|
|
|
|
$user->username = Request::input('username');
|
|
|
|
$user->email = Request::input('email');
|
|
|
|
$user->password = bcrypt(Request::input('password'));
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
Auth::login($user);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-06-21 14:34:27 +00:00
|
|
|
get('/lobby', function() {
|
2015-06-22 17:35:08 +00:00
|
|
|
return innerView();
|
2015-06-22 17:16:22 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
get('/deck-builder', function() {
|
2015-06-22 17:35:08 +00:00
|
|
|
return innerView();
|
|
|
|
});
|
|
|
|
|
|
|
|
get('/highscore', function() {
|
|
|
|
return innerView();
|
2015-06-21 14:34:27 +00:00
|
|
|
});
|
|
|
|
|
2015-06-19 16:50:05 +00:00
|
|
|
get('/', function() {
|
2015-06-22 10:16:40 +00:00
|
|
|
if(Auth::check()) {
|
|
|
|
return redirect('/lobby');
|
|
|
|
}
|
|
|
|
|
2015-06-22 17:16:22 +00:00
|
|
|
return view('app')->withSection('landing');
|
2015-06-22 17:35:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function innerView()
|
|
|
|
{
|
|
|
|
return view('app')->withSection('inner');
|
|
|
|
}
|