PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/app/routes.php

https://gitlab.com/melentev-av/perki.dev
PHP | 472 lines | 335 code | 92 blank | 45 comment | 13 complexity | 28e1ac877b5f384913e09bb9f3ba4ade MD5 | raw file
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Application Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register all of the routes for an application.
  8. | It's a breeze. Simply tell Laravel the URIs it should respond to
  9. | and give it the Closure to execute when that URI is requested.
  10. |
  11. */
  12. Route::get('/', array(
  13. 'as' => '/',
  14. 'uses' => 'PublicController@indexAction'
  15. ));
  16. Route::any('/support', array(
  17. 'as' => 'support',
  18. 'uses' => 'PublicController@supportAction'
  19. ));
  20. Route::any('check/code', array(
  21. 'as' => 'check/code',
  22. 'uses' => 'HomeController@checkCodeAction'
  23. ));
  24. Route::any('/user/social/login/{provider?}', array(
  25. 'as' => 'user/social/login',
  26. 'uses' => 'HomeController@socialLoginAction'
  27. ))->where(array('provider' => '(vkontakte|facebook|twitter)'));
  28. Route::any('/offer/list', array(
  29. 'as' => 'offer/list',
  30. 'uses' => 'OfferController@listAction'
  31. ));
  32. Route::any('/company/list', array(
  33. 'as' => 'company/list',
  34. 'uses' => 'CompanyController@listAction'
  35. ));
  36. Route::any('{id}', array(
  37. 'as' => 'entity',
  38. 'uses' => function($id){
  39. if (starts_with($id, '5'))
  40. return APP::make('EntityController')->offerAction($id);
  41. if (starts_with($id, '7'))
  42. return APP::make('EntityController')->giftAction($id);
  43. App::abort(404);
  44. }
  45. ))->where('id', '[0-9]{9,12}');
  46. Route::any('connect/{entity}', array(
  47. 'as' => 'entity/connect',
  48. 'uses' => function($entity){
  49. if (starts_with($entity, '7'))
  50. return APP::make('EntityController')->connectAction($entity);
  51. App::abort(404);
  52. }
  53. ))->where('entity', '[0-9]{9}');
  54. Route::any('/pay/process', array(
  55. 'as' => 'pay/process',
  56. 'uses' => 'PaymentController@robokassaProcessAction'
  57. ));
  58. if (App::environment() == 'local')
  59. {
  60. Route::any('/payment', array(
  61. 'uses' => 'PaymentController@robokassaLocalProcessAction'
  62. ));
  63. }
  64. Route::group(['before' => 'guest'], function()
  65. {
  66. Route::any('/signup', array(
  67. //'before' => 'csrf',
  68. 'as' => 'user/signup',
  69. 'uses' => 'UserController@signupAction'
  70. ));
  71. Route::any('/login', array(
  72. 'as' => 'user/login',
  73. 'uses' => 'UserController@loginAction'
  74. ));
  75. Route::any('/request', array(
  76. 'as' => 'user/request',
  77. 'uses' => 'UserController@requestAction'
  78. ));
  79. Route::any('/reset/{token}', array(
  80. 'as' => 'user/reset',
  81. 'uses' => 'UserController@resetAction'
  82. ));
  83. Route::any('/social', array(
  84. 'as' => 'user/social', function(){ return Redirect::route('/');}
  85. ));
  86. Route::any('/social/auth', array(
  87. 'as' => 'user/social/auth',
  88. 'uses' => 'HomeController@socialAuthAction'
  89. ));
  90. Route::any('/business/new', array(
  91. 'as' => 'business/new',
  92. 'uses' => 'UserController@newBusinessAction'
  93. ));
  94. });
  95. Route::group(['before' => 'auth'], function()
  96. {
  97. /*Route::any('get/share/{entity}', array(
  98. 'as' => 'get/share',
  99. 'uses' => 'UserProfileController@getShareAction'
  100. ))->where('entity', '[0-9]{9}');*/
  101. $controller = Auth::user() && Auth::user()->type == 'company' ? 'CompanyProfileController' : 'UserProfileController';
  102. $type = Auth::user() ? Auth::user()->type : '';
  103. if (Auth::user() && Auth::user()->role != 2)
  104. {
  105. Route::any('/profile', array(
  106. 'before' => 'company_wizard',
  107. 'as' => 'profile',
  108. 'uses' => $controller.'@indexAction'
  109. ));
  110. Route::any('/profile/edit', array(
  111. 'as' => 'profile/edit',
  112. 'uses' => $controller.'@editAction'
  113. ));
  114. Route::any('/settings', array(
  115. 'before' => 'company_wizard',
  116. 'as' => 'profile/settings',
  117. 'uses' => $controller.'@settingsAction'
  118. ));
  119. Route::get('/balance', array(
  120. 'before' => 'company_wizard',
  121. 'as' => 'profile/balance',
  122. 'uses' => $controller.'@balanceAction'
  123. ));
  124. Route::post('/balance', array(
  125. 'before' => 'company_wizard',
  126. 'as' => 'profile/balance',
  127. 'uses' => $controller.'@postBalanceAction'
  128. ));
  129. Route::get('/iterations', array(
  130. 'before' => 'company_wizard',
  131. 'as' => 'profile/iterations',
  132. 'uses' => $controller.'@balanceIterationsAction'
  133. ));
  134. Route::any('/orders', array(
  135. 'before' => 'company_wizard',
  136. 'as' => 'profile/orders',
  137. 'uses' => $controller.'@ordersAction'
  138. ));
  139. Route::get('/offers', array(
  140. 'before' => 'company_wizard',
  141. 'as' => 'profile/offer/list',
  142. 'uses' => 'OfferController@'.$type.'ProfileListAction'
  143. ));
  144. Route::post('/offer/create', array(
  145. 'as' => 'profile/offer/create',
  146. 'uses' => 'OfferController@createEditAction'
  147. ));
  148. Route::post('/offer/edit', array(
  149. 'as' => 'profile/offer/edit',
  150. 'uses' => 'OfferController@createEditAction'
  151. ));
  152. /*Route::post('/offer/destroy', array(
  153. 'as' => 'profile/offer/destroy',
  154. 'uses' => 'OfferController@destroyAction'
  155. ));*/
  156. }
  157. Route::group(['before' => 'auth.company'], function()
  158. {
  159. Route::any('/wizard', array(
  160. 'before' => 'company_wizard_complete',
  161. 'as' => 'profile/wizard',
  162. 'uses' => 'CompanyProfileController@wizardAction'
  163. ));
  164. Route::any('/offer/run', array(
  165. 'as' => 'profile/offer/run',
  166. 'uses' => 'OfferController@runAction'
  167. ));
  168. Route::group(array('before' => 'company_wizard'), function(){
  169. Route::post('/offer/reject', array(
  170. 'as' => 'profile/offer/reject',
  171. 'uses' => 'OfferController@rejectAction'
  172. ));
  173. Route::post('/wizard/bonus', array(
  174. 'as' => 'profile/wizard/bonus',
  175. 'uses' => 'CompanyProfileController@getWizardBonusAction'
  176. ));
  177. Route::post('/offer/stop', array(
  178. 'as' => 'profile/offer/stop',
  179. 'uses' => 'OfferController@stopAction'
  180. ));
  181. Route::any('/profile/statistic', array(
  182. 'as' => 'statistic',
  183. 'uses' => 'CompanyProfileController@statisticAction'
  184. ));
  185. Route::post('/gift/check', array(
  186. 'as' => 'gift/check',
  187. 'uses' => 'CompanyProfileController@giftCheckAction'
  188. ));
  189. Route::any('/order/pay/{id}', array(
  190. 'as' => 'order/pay',
  191. 'uses' => 'CompanyProfileController@payOrderAction'
  192. ))->where('id', '[0-9]+');
  193. Route::any('/order/cancel/{id}', array(
  194. 'as' => 'order/cancel',
  195. 'uses' => 'CompanyProfileController@cancelOrderAction'
  196. ))->where('id', '[0-9]+');
  197. Route::any('/pay/money/{id}', array(
  198. 'as' => 'profile/pay/money',
  199. 'uses' => 'CompanyProfileController@payMoneyAction'
  200. ))->where('id', '[0-9]+');
  201. Route::post('/profile/access/create', array(
  202. 'as' => 'profile/access/create',
  203. 'uses' => 'CompanyProfileController@accessCreateAction'
  204. ));
  205. Route::any('/partners', array(
  206. 'before' => 'company_wizard',
  207. 'as' => 'profile/partners',
  208. 'uses' => 'CompanyProfileController@partnersListAction'
  209. ));
  210. Route::any('/pay/success', array(
  211. 'as' => 'pay/success',
  212. 'uses' => 'PaymentController@robokassaSuccessAction'
  213. ));
  214. Route::any('/pay/fail', array(
  215. 'as' => 'pay/fail',
  216. 'uses' => 'PaymentController@robokassaFailAction'
  217. ));
  218. Route::any('/pay/make', array(
  219. 'as' => 'pay/make',
  220. 'uses' => 'PaymentController@robokassaMakeAction'
  221. ));
  222. Route::post('/perks/el/create', array(
  223. 'as' => 'perks/el/create',
  224. 'uses' => 'PerksManageController@elCreateAction'
  225. ));
  226. Route::post('/perks/printed/create', array(
  227. 'as' => 'perks/printed/create',
  228. 'uses' => 'PerksManageController@printedCreateAction'
  229. ));
  230. Route::post('/perks/sms/create', array(
  231. 'as' => 'perks/sms/create',
  232. 'uses' => 'PerksManageController@smsCreateAction'
  233. ));
  234. Route::get('/mailed', array(
  235. 'as' => 'perks/el/list',
  236. 'uses' => 'PerksManageController@elListAction'
  237. ));
  238. Route::get('/printed', array(
  239. 'as' => 'perks/printed/list',
  240. 'uses' => 'PerksManageController@printedListAction'
  241. ));
  242. Route::get('/sms', array(
  243. 'as' => 'perks/sms/list',
  244. 'uses' => 'PerksManageController@smsListAction'
  245. ));
  246. });
  247. });
  248. Route::group(['before' => 'auth.company.simple'], function()
  249. {
  250. Route::any('/dashboard', array(
  251. 'as' => 'dashboard',
  252. 'uses' => 'CompanyProfileController@dashboardAction'
  253. ));
  254. Route::post('/dashboard/check', array(
  255. 'as' => 'dashboard/check',
  256. 'uses' => 'CompanyProfileController@dashboardCheckAction'
  257. ));
  258. });
  259. Route::group(['before' => 'auth.user'], function()
  260. {
  261. /*Route::any('/pay/offer', array(
  262. 'as' => 'pay/offer',
  263. 'uses' => 'PayController@robokassaMakeOfferAction'
  264. ));
  265. Route::post('/comment/for/company/{id}', array(
  266. 'as' => 'profile/comment/for/company',
  267. 'uses' => 'UserProfileController@commentForCompanyAction'
  268. ))->where('id', '[0-9]{9}');
  269. Route::post('/comment/for/offer/{id}', array(
  270. 'as' => 'profile/comment/for/offer',
  271. 'uses' => 'UserProfileController@commentForOfferAction'
  272. ))->where('id', '[0-9]{9}');
  273. Route::post('/profile/company/search', array(
  274. 'as' => 'company/search',
  275. 'uses' => 'OfferController@searchCompanyAction'
  276. ));
  277. */
  278. Route::post('/profile/perk/start/sell', array(
  279. 'as' => 'profile/perk/start/sell',
  280. 'uses' => 'UserProfileController@startPerkSellAction'
  281. ));
  282. Route::any('/perks', array(
  283. 'as' => 'profile/perks',
  284. 'uses' => 'UserProfileController@perksAction'
  285. ));
  286. Route::any('/purchase', array(
  287. 'as' => 'profile/purchase',
  288. 'uses' => 'UserProfileController@purchaseAction'
  289. ));
  290. Route::any('/get/money/{id}', array(
  291. 'as' => 'profile/get/money',
  292. 'uses' => 'UserProfileController@getMoneyAction'
  293. ))->where('id', '[0-9]+');
  294. Route::any('/clan', array(
  295. 'as' => 'profile/clan',
  296. 'uses' => 'ClanProfileController@indexAction'
  297. ));
  298. Route::any('/profile/change/email', array(
  299. 'as' => 'profile/change/email',
  300. 'uses' => 'UserProfileController@changeEmailAction'
  301. ));
  302. Route::post('gift/reject', array(
  303. 'as' => 'profile/gift/reject',
  304. 'uses' => 'OfferController@giftRejectAction'
  305. ));
  306. });
  307. Route::any('/logout', array(
  308. 'as' => 'user/logout',
  309. 'uses' => 'UserController@logoutAction'
  310. ));
  311. Route::post('/upload/image', array(
  312. 'as' => 'upload/image',
  313. 'uses' => 'UploadController@imageAction'
  314. ));
  315. Route::any('/image/crop/logo', array(
  316. 'as' => 'image/crop/logo',
  317. 'uses' => 'ImageController@cropLogoAction'
  318. ));
  319. Route::any('/image/crop/cover', array(
  320. 'as' => 'image/crop/cover',
  321. 'uses' => 'ImageController@cropCoverAction'
  322. ));
  323. if (Auth::user() && Auth::user()->role == 4)
  324. {
  325. Route::get('/mng/export/gift_order/{id}', array(
  326. 'as' => 'mng/export/gift_order',
  327. 'uses' => 'MngController@exportGiftOrderAction'
  328. ));
  329. }
  330. });
  331. Route::post('/payment/yaKassaCheck', array(
  332. 'uses' => 'PaymentController@yaKassaCheckAction'
  333. ));
  334. Route::post('/payment/yaKassaAvisio', array(
  335. 'uses' => 'PaymentController@yaKassaAvisioAction'
  336. ));
  337. /*
  338. ================================================================
  339. * Блок роутов для API
  340. * TODO: API ROUTING
  341. ================================================================
  342. */
  343. Route::any('api/v1/login', array(
  344. 'as' => 'api/v1/login',
  345. 'uses' => 'ApiController@loginEmailAction',
  346. ));
  347. Route::any('api/v1/singup', array(
  348. 'as' => 'api/v1/singup',
  349. 'uses' => 'ApiController@singUpEmailAction',
  350. ));
  351. Route::group( array('prefix' => 'api/v1', 'before' => 'auth.token'), function()
  352. {
  353. Route::any('get/balance', array(
  354. 'as' => 'api/v1/get/balance',
  355. 'uses' => 'ApiController@getUserBalanceInfoAction'
  356. ));
  357. Route::any('check/gift', array(
  358. 'as' => 'api/v1/check/gift',
  359. 'uses' => 'ApiController@checkGiftAction'
  360. ));
  361. Route::any('activate/gift', array(
  362. 'as' => 'api/v1/activate/gift',
  363. 'uses' => 'ApiController@activateGiftAction'
  364. ));
  365. Route::any('get/list-balance', array(
  366. 'as' => 'api/v1/get/list-balance',
  367. 'uses' => 'ApiController@getUserBalanceIterationsAction'
  368. ));
  369. Route::any('get/perks-list', array(
  370. 'as' => 'api/v1/get/perks-list',
  371. 'uses' => 'ApiController@getPerksListUserAction',
  372. ));
  373. Route::any('get/perk', array(
  374. 'as' => 'api/v1/get/perk',
  375. 'uses' => 'ApiController@getPerkUserAction',
  376. ));
  377. });