/app/routes.php
PHP | 472 lines | 335 code | 92 blank | 45 comment | 13 complexity | 28e1ac877b5f384913e09bb9f3ba4ade MD5 | raw file
- <?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 Closure to execute when that URI is requested.
- |
- */
- Route::get('/', array(
- 'as' => '/',
- 'uses' => 'PublicController@indexAction'
- ));
- Route::any('/support', array(
- 'as' => 'support',
- 'uses' => 'PublicController@supportAction'
- ));
- Route::any('check/code', array(
- 'as' => 'check/code',
- 'uses' => 'HomeController@checkCodeAction'
- ));
- Route::any('/user/social/login/{provider?}', array(
- 'as' => 'user/social/login',
- 'uses' => 'HomeController@socialLoginAction'
- ))->where(array('provider' => '(vkontakte|facebook|twitter)'));
- Route::any('/offer/list', array(
- 'as' => 'offer/list',
- 'uses' => 'OfferController@listAction'
- ));
- Route::any('/company/list', array(
- 'as' => 'company/list',
- 'uses' => 'CompanyController@listAction'
- ));
- Route::any('{id}', array(
- 'as' => 'entity',
- 'uses' => function($id){
- if (starts_with($id, '5'))
- return APP::make('EntityController')->offerAction($id);
- if (starts_with($id, '7'))
- return APP::make('EntityController')->giftAction($id);
- App::abort(404);
- }
- ))->where('id', '[0-9]{9,12}');
- Route::any('connect/{entity}', array(
- 'as' => 'entity/connect',
- 'uses' => function($entity){
- if (starts_with($entity, '7'))
- return APP::make('EntityController')->connectAction($entity);
- App::abort(404);
- }
- ))->where('entity', '[0-9]{9}');
- Route::any('/pay/process', array(
- 'as' => 'pay/process',
- 'uses' => 'PaymentController@robokassaProcessAction'
- ));
- if (App::environment() == 'local')
- {
- Route::any('/payment', array(
- 'uses' => 'PaymentController@robokassaLocalProcessAction'
- ));
- }
- Route::group(['before' => 'guest'], function()
- {
- Route::any('/signup', array(
- //'before' => 'csrf',
- 'as' => 'user/signup',
- 'uses' => 'UserController@signupAction'
- ));
- Route::any('/login', array(
- 'as' => 'user/login',
- 'uses' => 'UserController@loginAction'
- ));
- Route::any('/request', array(
- 'as' => 'user/request',
- 'uses' => 'UserController@requestAction'
- ));
- Route::any('/reset/{token}', array(
- 'as' => 'user/reset',
- 'uses' => 'UserController@resetAction'
- ));
- Route::any('/social', array(
- 'as' => 'user/social', function(){ return Redirect::route('/');}
- ));
- Route::any('/social/auth', array(
- 'as' => 'user/social/auth',
- 'uses' => 'HomeController@socialAuthAction'
- ));
- Route::any('/business/new', array(
- 'as' => 'business/new',
- 'uses' => 'UserController@newBusinessAction'
- ));
- });
- Route::group(['before' => 'auth'], function()
- {
- /*Route::any('get/share/{entity}', array(
- 'as' => 'get/share',
- 'uses' => 'UserProfileController@getShareAction'
- ))->where('entity', '[0-9]{9}');*/
- $controller = Auth::user() && Auth::user()->type == 'company' ? 'CompanyProfileController' : 'UserProfileController';
- $type = Auth::user() ? Auth::user()->type : '';
- if (Auth::user() && Auth::user()->role != 2)
- {
- Route::any('/profile', array(
- 'before' => 'company_wizard',
- 'as' => 'profile',
- 'uses' => $controller.'@indexAction'
- ));
- Route::any('/profile/edit', array(
- 'as' => 'profile/edit',
- 'uses' => $controller.'@editAction'
- ));
- Route::any('/settings', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/settings',
- 'uses' => $controller.'@settingsAction'
- ));
- Route::get('/balance', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/balance',
- 'uses' => $controller.'@balanceAction'
- ));
- Route::post('/balance', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/balance',
- 'uses' => $controller.'@postBalanceAction'
- ));
- Route::get('/iterations', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/iterations',
- 'uses' => $controller.'@balanceIterationsAction'
- ));
- Route::any('/orders', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/orders',
- 'uses' => $controller.'@ordersAction'
- ));
- Route::get('/offers', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/offer/list',
- 'uses' => 'OfferController@'.$type.'ProfileListAction'
- ));
- Route::post('/offer/create', array(
- 'as' => 'profile/offer/create',
- 'uses' => 'OfferController@createEditAction'
- ));
- Route::post('/offer/edit', array(
- 'as' => 'profile/offer/edit',
- 'uses' => 'OfferController@createEditAction'
- ));
- /*Route::post('/offer/destroy', array(
- 'as' => 'profile/offer/destroy',
- 'uses' => 'OfferController@destroyAction'
- ));*/
- }
- Route::group(['before' => 'auth.company'], function()
- {
- Route::any('/wizard', array(
- 'before' => 'company_wizard_complete',
- 'as' => 'profile/wizard',
- 'uses' => 'CompanyProfileController@wizardAction'
- ));
- Route::any('/offer/run', array(
- 'as' => 'profile/offer/run',
- 'uses' => 'OfferController@runAction'
- ));
- Route::group(array('before' => 'company_wizard'), function(){
- Route::post('/offer/reject', array(
- 'as' => 'profile/offer/reject',
- 'uses' => 'OfferController@rejectAction'
- ));
-
- Route::post('/wizard/bonus', array(
- 'as' => 'profile/wizard/bonus',
- 'uses' => 'CompanyProfileController@getWizardBonusAction'
- ));
- Route::post('/offer/stop', array(
- 'as' => 'profile/offer/stop',
- 'uses' => 'OfferController@stopAction'
- ));
- Route::any('/profile/statistic', array(
- 'as' => 'statistic',
- 'uses' => 'CompanyProfileController@statisticAction'
- ));
- Route::post('/gift/check', array(
- 'as' => 'gift/check',
- 'uses' => 'CompanyProfileController@giftCheckAction'
- ));
- Route::any('/order/pay/{id}', array(
- 'as' => 'order/pay',
- 'uses' => 'CompanyProfileController@payOrderAction'
- ))->where('id', '[0-9]+');
- Route::any('/order/cancel/{id}', array(
- 'as' => 'order/cancel',
- 'uses' => 'CompanyProfileController@cancelOrderAction'
- ))->where('id', '[0-9]+');
- Route::any('/pay/money/{id}', array(
- 'as' => 'profile/pay/money',
- 'uses' => 'CompanyProfileController@payMoneyAction'
- ))->where('id', '[0-9]+');
- Route::post('/profile/access/create', array(
- 'as' => 'profile/access/create',
- 'uses' => 'CompanyProfileController@accessCreateAction'
- ));
- Route::any('/partners', array(
- 'before' => 'company_wizard',
- 'as' => 'profile/partners',
- 'uses' => 'CompanyProfileController@partnersListAction'
- ));
- Route::any('/pay/success', array(
- 'as' => 'pay/success',
- 'uses' => 'PaymentController@robokassaSuccessAction'
- ));
- Route::any('/pay/fail', array(
- 'as' => 'pay/fail',
- 'uses' => 'PaymentController@robokassaFailAction'
- ));
- Route::any('/pay/make', array(
- 'as' => 'pay/make',
- 'uses' => 'PaymentController@robokassaMakeAction'
- ));
- Route::post('/perks/el/create', array(
- 'as' => 'perks/el/create',
- 'uses' => 'PerksManageController@elCreateAction'
- ));
- Route::post('/perks/printed/create', array(
- 'as' => 'perks/printed/create',
- 'uses' => 'PerksManageController@printedCreateAction'
- ));
- Route::post('/perks/sms/create', array(
- 'as' => 'perks/sms/create',
- 'uses' => 'PerksManageController@smsCreateAction'
- ));
- Route::get('/mailed', array(
- 'as' => 'perks/el/list',
- 'uses' => 'PerksManageController@elListAction'
- ));
- Route::get('/printed', array(
- 'as' => 'perks/printed/list',
- 'uses' => 'PerksManageController@printedListAction'
- ));
- Route::get('/sms', array(
- 'as' => 'perks/sms/list',
- 'uses' => 'PerksManageController@smsListAction'
- ));
- });
- });
- Route::group(['before' => 'auth.company.simple'], function()
- {
- Route::any('/dashboard', array(
- 'as' => 'dashboard',
- 'uses' => 'CompanyProfileController@dashboardAction'
- ));
- Route::post('/dashboard/check', array(
- 'as' => 'dashboard/check',
- 'uses' => 'CompanyProfileController@dashboardCheckAction'
- ));
- });
- Route::group(['before' => 'auth.user'], function()
- {
- /*Route::any('/pay/offer', array(
- 'as' => 'pay/offer',
- 'uses' => 'PayController@robokassaMakeOfferAction'
- ));
- Route::post('/comment/for/company/{id}', array(
- 'as' => 'profile/comment/for/company',
- 'uses' => 'UserProfileController@commentForCompanyAction'
- ))->where('id', '[0-9]{9}');
- Route::post('/comment/for/offer/{id}', array(
- 'as' => 'profile/comment/for/offer',
- 'uses' => 'UserProfileController@commentForOfferAction'
- ))->where('id', '[0-9]{9}');
- Route::post('/profile/company/search', array(
- 'as' => 'company/search',
- 'uses' => 'OfferController@searchCompanyAction'
- ));
- */
- Route::post('/profile/perk/start/sell', array(
- 'as' => 'profile/perk/start/sell',
- 'uses' => 'UserProfileController@startPerkSellAction'
- ));
- Route::any('/perks', array(
- 'as' => 'profile/perks',
- 'uses' => 'UserProfileController@perksAction'
- ));
- Route::any('/purchase', array(
- 'as' => 'profile/purchase',
- 'uses' => 'UserProfileController@purchaseAction'
- ));
- Route::any('/get/money/{id}', array(
- 'as' => 'profile/get/money',
- 'uses' => 'UserProfileController@getMoneyAction'
- ))->where('id', '[0-9]+');
- Route::any('/clan', array(
- 'as' => 'profile/clan',
- 'uses' => 'ClanProfileController@indexAction'
- ));
- Route::any('/profile/change/email', array(
- 'as' => 'profile/change/email',
- 'uses' => 'UserProfileController@changeEmailAction'
- ));
- Route::post('gift/reject', array(
- 'as' => 'profile/gift/reject',
- 'uses' => 'OfferController@giftRejectAction'
- ));
- });
- Route::any('/logout', array(
- 'as' => 'user/logout',
- 'uses' => 'UserController@logoutAction'
- ));
- Route::post('/upload/image', array(
- 'as' => 'upload/image',
- 'uses' => 'UploadController@imageAction'
- ));
- Route::any('/image/crop/logo', array(
- 'as' => 'image/crop/logo',
- 'uses' => 'ImageController@cropLogoAction'
- ));
- Route::any('/image/crop/cover', array(
- 'as' => 'image/crop/cover',
- 'uses' => 'ImageController@cropCoverAction'
- ));
- if (Auth::user() && Auth::user()->role == 4)
- {
- Route::get('/mng/export/gift_order/{id}', array(
- 'as' => 'mng/export/gift_order',
- 'uses' => 'MngController@exportGiftOrderAction'
- ));
- }
- });
- Route::post('/payment/yaKassaCheck', array(
- 'uses' => 'PaymentController@yaKassaCheckAction'
- ));
- Route::post('/payment/yaKassaAvisio', array(
- 'uses' => 'PaymentController@yaKassaAvisioAction'
- ));
- /*
- ================================================================
- * Блок роутов для API
- * TODO: API ROUTING
- ================================================================
- */
- Route::any('api/v1/login', array(
- 'as' => 'api/v1/login',
- 'uses' => 'ApiController@loginEmailAction',
- ));
- Route::any('api/v1/singup', array(
- 'as' => 'api/v1/singup',
- 'uses' => 'ApiController@singUpEmailAction',
- ));
- Route::group( array('prefix' => 'api/v1', 'before' => 'auth.token'), function()
- {
- Route::any('get/balance', array(
- 'as' => 'api/v1/get/balance',
- 'uses' => 'ApiController@getUserBalanceInfoAction'
- ));
- Route::any('check/gift', array(
- 'as' => 'api/v1/check/gift',
- 'uses' => 'ApiController@checkGiftAction'
- ));
- Route::any('activate/gift', array(
- 'as' => 'api/v1/activate/gift',
- 'uses' => 'ApiController@activateGiftAction'
- ));
- Route::any('get/list-balance', array(
- 'as' => 'api/v1/get/list-balance',
- 'uses' => 'ApiController@getUserBalanceIterationsAction'
- ));
- Route::any('get/perks-list', array(
- 'as' => 'api/v1/get/perks-list',
- 'uses' => 'ApiController@getPerksListUserAction',
- ));
- Route::any('get/perk', array(
- 'as' => 'api/v1/get/perk',
- 'uses' => 'ApiController@getPerkUserAction',
- ));
- });