<?php

use App\Events\VoiceSearchData;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Redirect;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function(){
	return Redirect::to('canada');
});
Route::group(array('prefix' => 'canada'),function() {
Route::any('{model?}/{action?}/{sub?}/{xid?}/{key?}',function($model=null,$action=null,$sub=null,$xid=null,$key=null)
	{	if(!$action && !$model) return App::make("App\Http\Controllers\Canada\Index")->index();
		else{
			if(!$action) return App::make("App\Http\Controllers\Canada\\".ucfirst($model))->index();
			else return App::make("App\Http\Controllers\Canada\\".ucfirst($model))->$action($sub,$xid,$key);
		}
	});
});


Route::get('/pusher', function(){
	echo "<pre>";
	print_r(event(new VoiceSearchData('hello world')));
});