I'm going through a very strange problem.
When using Windows (Windows 7), my page loads as expected:
@extends + index.php
In Linux (Ubuntu 13.10) he is redirecting me to the / user / login route for no reason:
@extends + login.php
On both systems, the folder was copied from the dropbox without the vendor and later installed via composer install
I thought the filter or the routes might have something conflicting, but it does not make sense for one system to load normally and the other to call for an unexpected page.
Route:
<?php
/** ------------------------------------------
* Route model binding
* ------------------------------------------
*/
Route::model('user', 'User');
Route::model('comment', 'Comment');
Route::model('post', 'Post');
Route::model('role', 'Role');
Route::resource('upload', 'UploadController');
/** ------------------------------------------
* Admin Routes
* ------------------------------------------
*/
Route::group(['prefix' => 'admin', 'before' => 'auth'], function()
{
Route::pattern('user', '[0-9]+');
Route::pattern('role', '[0-9]+');
# User Management
Route::get('users/{user}/show', 'AdminUsersController@getShow');
Route::get('users/{user}/edit', 'AdminUsersController@getEdit');
Route::post('users/{user}/edit', 'AdminUsersController@postEdit');
Route::get('users/{user}/delete', 'AdminUsersController@getDelete');
Route::post('users/{user}/delete', 'AdminUsersController@postDelete');
Route::controller('users', 'AdminUsersController');
# User Role Management
Route::get('roles/{role}/show', 'AdminRolesController@getShow');
Route::get('roles/{role}/edit', 'AdminRolesController@getEdit');
Route::post('roles/{role}/edit', 'AdminRolesController@postEdit');
Route::get('roles/{role}/delete', 'AdminRolesController@getDelete');
Route::post('roles/{role}/delete', 'AdminRolesController@postDelete');
Route::controller('roles', 'AdminRolesController');
# Optional
Route::get('faq', 'AdminUsersController@getFaq');
Route::get('profile', 'AdminUsersController@getProfile');
Route::get('mural', 'AdminUsersController@getMural');
# Admin Dashboard
Route::controller('/', 'AdminDashboardController');
});
/** ------------------------------------------
* User Routes
* ------------------------------------------
*/
Route::group(['prefix' => 'user', 'before' => 'auth'], function()
{
// User reset routes
Route::get('reset/{token}', 'UserController@getReset')
->where('token', '[0-9a-z]+');
// User password reset
Route::post('reset/{token}', 'UserController@postReset')
->where('token', '[0-9a-z]+');
//:: User Account Routes ::
Route::post('{user}/edit', 'UserController@postEdit')
->where('user', '[0-9]+');
# Admin Dashboard
Route::controller('/', 'UserDashboardController');
});
/** ------------------------------------------
* Frontend Routes
* ------------------------------------------
*/
//:: User Account Routes ::
Route::post('user/login', 'UserController@postLogin');
# User RESTful Routes (Login, Logout, Register, etc)
Route::controller('user', 'UserController');
# Index Page - Last route, no matches
Route::get('/', ['before' => 'detectLang','uses' => 'UserController@getIndex']);
Route::post('/', ['before' => 'detectLang','uses' => 'UserController@postIndex']);
Filter:
<?php
App::before(function($request)
{
//
});
App::after(function($request, $response)
{
//
});
Route::filter('auth', function()
{
if (Auth::guest()) {
Session::put('loginRedirect', Request::url());
return Redirect::to('/');
}
});
Route::filter('auth.basic', function()
{
return Auth::basic();
});
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/');
});
// Check for role on all admin routes
Entrust::routeNeedsRole( 'admin*', array('admin'), Redirect::to('/') );
// Check for permissions on admin actions
Entrust::routeNeedsPermission( 'admin/blogs*', 'full', Redirect::to('/admin') );
Entrust::routeNeedsPermission( 'admin/comments*', 'full', Redirect::to('/admin') );
Entrust::routeNeedsPermission( 'admin/users*', 'full', Redirect::to('/admin') );
Entrust::routeNeedsPermission( 'admin/roles*', 'full', Redirect::to('/admin') );
Route::filter('csrf', function()
{
if (Request::ajax()){
if (Session::getToken() != Request::header('X-CSRF-Token')){
throw new Illuminate\Session\TokenMismatchException;
}
}else if (Session::getToken() != Input::get('csrf_token') && Session::getToken() != Input::get('_token')){
throw new Illuminate\Session\TokenMismatchException;
}
});
Route::filter('detectLang', function($route, $request, $lang = 'auto')
{
if($lang != "auto" && in_array($lang , Config::get('app.available_language')))
{
Config::set('app.locale', $lang);
}else{
$browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
$browser_lang = substr($browser_lang, 0,2);
$userLang = (in_array($browser_lang, Config::get('app.available_language'))) ? $browser_lang : Config::get('app.locale');
Config::set('app.locale', $userLang);
App::setLocale($userLang);
}
});
Index:
@extends('layouts.default')
@section('header')
@parent
@stop
on Windows:
inUbuntu: