Esempio n. 1
0
 /**
  * Handle an incoming request.
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!app()->make('ConferenceBaseController')->getDepartment() && !isAdminPanel()) {
         return redirect('/' . LaravelLocalization::setLocale());
     }
     return $next($request);
 }
Esempio n. 2
0
 public function t_fild($ident)
 {
     $lang = LaravelLocalization::setLocale();
     if ($lang) {
         $ident = $ident . "_" . $lang;
     }
     return $ident;
 }
Esempio n. 3
0
 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function (Router $router) {
         $this->loadApiRoutes($router);
     });
     $router->group(['namespace' => $this->namespace, 'prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localizationRedirect']], function (Router $router) {
         $this->loadBackendRoutes($router);
         $this->loadFrontendRoutes($router);
     });
 }
Esempio n. 4
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $laravelLocale = LaravelLocalization::setLocale() ?: $this->app->config->get('app.fallback_locale');
     $locale = '/' . $laravelLocale;
     $departments = app()->make('ConferenceBaseController')->getDepartments();
     if (count($departments) == 1 && !$request->segment(2)) {
         return redirect($locale . '/' . $departments->first()['keyword']);
     }
     return $next($request);
 }
 public function getCreate()
 {
     // Title
     $title = 'Boite de réception';
     JavaScript::put(['locale' => LaravelLocalization::setLocale()]);
     $data = array('action' => 'add', 'title' => $title, 'uriModule' => route('create_contacts'), 'contact' => array());
     // Show the page
     return View::make('admin.create', $data);
 }
Esempio n. 6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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.
|
*/
/** This group is used to Localize Routes to the right language **/
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localizationRedirect', 'localeSessionRedirect', 'localize']], function () {
    /*-- Landing Page --*/
    Route::get('/', ['as' => 'home', 'uses' => 'ProjectsController@index']);
    Route::get(LaravelLocalization::transRoute('routes.project') . '/{slug}', 'ProjectsController@show');
    Route::get(LaravelLocalization::transRoute('routes.current-projects'), 'ProjectsController@showMoreProjects');
    Route::get(LaravelLocalization::transRoute('routes.successful-projects'), 'ProjectsController@showMoreSuccProjects');
    Route::get(LaravelLocalization::transRoute('routes.create-project'), 'ProjectsController@createProject');
    Route::post(LaravelLocalization::transRoute('routes.create-project/store'), 'ProjectsController@store');
    Route::get(LaravelLocalization::transRoute('routes.get-locale'), 'AjaxController@getLocale');
    /*-- HowItWorks Page --*/
    Route::get(LaravelLocalization::transRoute('routes.how-it-works'), 'PagesController@howItWorks');
    /*-- Sponsors Page --*/
    Route::get(LaravelLocalization::transRoute('routes.sponsors'), 'PagesController@sponsors');
    /*-- Imprint Page --*/
    Route::get(LaravelLocalization::transRoute('routes.imprint'), 'PagesController@imprint');
    /*-- Contact Page --*/
    Route::get(LaravelLocalization::transRoute('routes.contact'), 'ContactFormController@getContactForm');
Esempio n. 7
0
 public function getLanguage()
 {
     return LaravelLocalization::setLocale() ?: 'en';
 }
Esempio n. 8
0
function setCurrentLocale($localeCode)
{
    LaravelLocalization::setLocale($localeCode);
}