Example #1
0
<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::post('language', function (Illuminate\Http\Request $request) {
    $data = $request->only(['language']);
    if (Auth::check()) {
        App\Http\Controllers\UserController::setLanguageCode($data['language'], Auth::user()->id);
    }
    return back()->withCookie(cookie()->forever('locale', $data['language']));
});
Route::group(['middleware' => ['web']], function () {
    Route::auth();
    Route::get('/home', 'HomeController@index');
    Route::get('/user/me', 'UserController@me');
});
Route::group(['prefix' => 'facebook', 'middleware' => 'web'], function () {
    Route::get('jsAuth', 'FacebookController@authenticateFromJavascript');
});
Route::group(['middleware' => ['web']], function () {
    Route::get('/map', function () {
        return view('map');
    });