myapp.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. use App\Helpers\Utils;
  3. use App\Http\Controllers\Front\Dabory\Myapp\Sso\SsoAppController;
  4. use Illuminate\Support\Facades\Artisan;
  5. use Illuminate\Support\Facades\Route;
  6. use App\Helpers\ProUtils;
  7. use Illuminate\Support\Facades\Storage;
  8. Route::middleware(['check.gate.token', 'app.token.manager'])->group(function () {
  9. //Route::middleware(['check.gate.token', 'check.company.sort', 'app.token.manager'])->group(function () {
  10. //Route::group(['middleware' => 'check.pro.member'], function () {
  11. Route::group(['middleware' => 'check.pro.member'], function () {
  12. // Route::prefix('my-app')->name('my-app.')->group(function () {
  13. Route::group(['prefix' => 'dabory/myapp', 'as' => 'myapp.'], function () {
  14. Route::get('/list-type/type1', Utils::makeFrontRoute('/dabory/erp/list-type/type1'));
  15. Route::get('/list-type/list-media1', Utils::makeFrontRoute('/dabory/erp/list-type/list-media1'));
  16. Route::get('/master-data/item', Utils::makeFrontRoute('/dabory/erp/master-data/item'));
  17. Route::get('/basic-settings/item-optpro', Utils::makeFrontRoute('/dabory/erp/basic-settings/item-optpro'));
  18. Route::get('/change-sort-menu/{sort_menu_id}', function ($sortMenuId) {
  19. $sortMenuPage = ProUtils::getSortMenu()['Page'] ?? [];
  20. $filterSortMenu = collect($sortMenuPage)->filter(function ($sortMenu) use($sortMenuId) {
  21. return $sortMenu['Id'] === (int)$sortMenuId;
  22. })->first();
  23. session()->put('member.SortMenu', $filterSortMenu);
  24. return redirect()->to($filterSortMenu['C4']);
  25. })->name('change-sort-menu');
  26. Route::get('/country-code', function () {
  27. session()->put('member.CountryCode', request('code'));
  28. // dd(session('member'));
  29. return redirect()->back();
  30. });
  31. Route::get('/sso/sso-app', [SsoAppController::class, 'index']);
  32. Route::post('/clear-menu-cache', function () {
  33. Storage::delete('dabory-footage/members/' . session('member')['MemberId'] . '/member-menu');
  34. });
  35. Route::get('/clear-cache', function () {
  36. Artisan::call('event:clear');
  37. Artisan::call('cache:clear');
  38. Artisan::call('optimize:clear');
  39. Artisan::call('route:clear');
  40. Artisan::call('view:clear');
  41. // Storage::deleteDirectory('dabory-footage/members/' . session('member')['MemberId']);
  42. Storage::deleteDirectory('dabory-footage/members');
  43. return redirect()->back();
  44. })->name('clear.cache');
  45. Route::get('/', function() {
  46. // sortTpye 첫번 째 세션에 저장
  47. $sessionSortMenu = session()->get('member.SortMenu');
  48. $sortMenuPage = ProUtils::getSortMenu()['Page'] ?? [];
  49. if (empty($sortMenuPage)) {
  50. $sortMenu = '';
  51. } else if ($sessionSortMenu) {
  52. $sortMenu = $sessionSortMenu;
  53. } else {
  54. $sortMenu = $sortMenuPage[0];
  55. }
  56. session()->put('member.SortMenu', $sortMenu);
  57. // dd(session('member'));
  58. return view('front.dabory.myapp.index');
  59. })->name('index');
  60. });
  61. });
  62. });