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');
    });
Example #2
0
 public function testCustomRestoreRoute()
 {
     $mockRedirect = Mockery::mock('\\Illuminate\\Http\\Redirector');
     $mockRedirect->shouldReceive('route')->with("customIndex")->andReturnSelf();
     $mockRedirect->shouldReceive('with')->withArgs(["error", "user.undo.invalid"])->andReturnSelf();
     \Illuminate\Support\Facades\Redirect::swap($mockRedirect);
     $uc = new \App\Http\Controllers\UserController();
     $redirect = $uc->restoreModel(10000, new User(), "customIndex");
 }