Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #27 from AudithSoftworks/upgrades
Browse files Browse the repository at this point in the history
Middleware fix
  • Loading branch information
shehi committed Feb 27, 2016
2 parents ba7cad8 + ee6d242 commit b7519aa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -36,10 +36,11 @@ install:
- case $PHP_VERSION in '5.5') export DOCKER_COMPOSE_FILE='./docker-compose-php55.yml' ;; '5.6') export DOCKER_COMPOSE_FILE='./docker-compose-php56.yml' ;; 'hhvm') export DOCKER_COMPOSE_FILE='./docker-compose-hhvm.yml' ;; esac
&& docker-compose -f $DOCKER_COMPOSE_FILE pull
- case $PHP_VERSION in '5.5') export DOCKER_COMPOSE_FILE='./docker-compose-php55.yml' ;; '5.6') export DOCKER_COMPOSE_FILE='./docker-compose-php56.yml' ;; 'hhvm') export DOCKER_COMPOSE_FILE='./docker-compose-hhvm.yml' ;; esac
&& docker-compose -f $DOCKER_COMPOSE_FILE up -d && docker-compose ps
&& docker-compose -f $DOCKER_COMPOSE_FILE up -d

# Create database for MySQL and PgSQL
- sleep 15;
docker-compose ps;
mysql -h $(docker inspect -f '{{ .NetworkSettings.IPAddress }}' basis_mysql56_1) -u root -e "CREATE DATABASE IF NOT EXISTS basis;";
if [[ $PHP_VERSION != 'hhvm' ]]; then psql -h $(docker inspect -f '{{ .NetworkSettings.IPAddress }}' basis_postgres94_1) -U postgres -c "CREATE DATABASE basis;"; fi;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Expand Up @@ -30,7 +30,7 @@ class Kernel extends HttpKernel
Middleware\VerifyCsrfToken::class
],
'api' => [
'throttle:60,1',
'throttle:60,1'
],
];

Expand Down
5 changes: 4 additions & 1 deletion app/Http/Middleware/Localization.php
Expand Up @@ -14,7 +14,10 @@ class Localization
*/
public function handle(Request $request, \Closure $next)
{
app('translator')->setLocale($request->segment(1));
if (empty($locale = $request->segment(1)) || !array_key_exists($locale, config('app.locales'))) {
$locale = config('app.fallback_locale');
}
app('translator')->setLocale($locale);

return $next($request);
}
Expand Down
11 changes: 6 additions & 5 deletions app/Providers/RouteServiceProvider.php
Expand Up @@ -38,21 +38,22 @@ public function boot(Router $router)
*/
public function map(Router $router)
{
$defaultLocale = config('app.locale');
$namespace = $this->namespace;
$middleware = 'web';

//-----------------------------------------------------------------------
// Non-localized, generic routes (such as those for admin panel etc).
//-----------------------------------------------------------------------

$router->group(['namespace' => $this->namespace], function (Router $router) {
$router->group(compact('namespace', 'middleware'), function (Router $router) {
$router->get('/oauth/{provider}', 'Users\AuthController@getOAuth');
});

//-----------------------------------------------------------------------------------------------------
// Register localized routes with locale-prefices (in case of default locale, no prefix is attached).
//-----------------------------------------------------------------------------------------------------

$defaultLocale = config('app.locale');
$namespace = $this->namespace;
$middleware = 'web';
foreach (config('app.locales') as $prefix => $localeName) {
app('translator')->setLocale($prefix);
// Skip default locale for now.
Expand All @@ -71,7 +72,7 @@ public function map(Router $router)
//------------------------------------------------

app('translator')->setLocale($defaultLocale);
$router->group(compact('namespace'), function (Router $router) use ($defaultLocale) {
$router->group(compact('namespace', 'middleware'), function (Router $router) use ($defaultLocale) {
$this->localizedRoutes($router, $defaultLocale);
});
}
Expand Down
3 changes: 2 additions & 1 deletion circle.yml
Expand Up @@ -43,10 +43,11 @@ dependencies:
- case `expr $CIRCLE_NODE_INDEX % $CIRCLE_NODE_TOTAL` in 0) export DOCKER_COMPOSE_FILE='./docker-compose-php56.yml' ;; 1) export DOCKER_COMPOSE_FILE='./docker-compose-hhvm.yml' ;; esac
&& docker-compose -f $DOCKER_COMPOSE_FILE pull
- case `expr $CIRCLE_NODE_INDEX % $CIRCLE_NODE_TOTAL` in 0) export DOCKER_COMPOSE_FILE='./docker-compose-php56.yml' ;; 1) export DOCKER_COMPOSE_FILE='./docker-compose-hhvm.yml' ;; esac
&& docker-compose -f $DOCKER_COMPOSE_FILE up -d && docker-compose ps
&& docker-compose -f $DOCKER_COMPOSE_FILE up -d

# Create database for MySQL and PgSQL
- sleep 5;
docker-compose ps;
mysql -h $(docker inspect -f '{{ .NetworkSettings.IPAddress }}' basis_mysql56_1) -u root -e "CREATE DATABASE IF NOT EXISTS basis;";
if [[ `expr $CIRCLE_NODE_INDEX % $CIRCLE_NODE_TOTAL` != 1 ]]; then psql -h $(docker inspect -f '{{ .NetworkSettings.IPAddress }}' basis_postgres94_1) -U postgres -c "CREATE DATABASE basis;"; fi;

Expand Down
1 change: 1 addition & 0 deletions public/index.php
Expand Up @@ -4,6 +4,7 @@

$app = require_once __DIR__.'/../bootstrap/app.php';

/** @var \Illuminate\Contracts\Http\Kernel $kernel */
$kernel = $app->make(\Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
Expand Down
3 changes: 3 additions & 0 deletions storage/build/scripts/dev-env/build.sh
Expand Up @@ -50,4 +50,7 @@ docker exec basis_php56_1 /bin/bash -c "
compass compile;
gulp;
composer selfupdate && composer update --prefer-source --no-interaction;
./artisan key:generate;
./artisan migrate;
";

0 comments on commit b7519aa

Please sign in to comment.