🍲dfcv🏰dd⋉(● ∸ ●)⋊@% PNG %k25u25%fgd5n! PNG %k25u25%fgd5n!AuthServiceProvider.php000064400000001335152427531020011215 0ustar00 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // Implicitly grant "Super Admin" role all permissions Gate::before(function ($user, $ability) { return $user->hasRole('Super Admin') ? true : null; }); } } EventServiceProvider.php000064400000001264152427531020011376 0ustar00 [ SendEmailVerificationNotification::class, ], ]; /** * Register any events for your application. * * @return void */ public function boot() { parent::boot(); // } } AppServiceProvider.php000064400000004544152427531020011041 0ustar00user(); $categories = PageCategory::with([ 'pages' => function ($q) { $q->where(function ($query) { // grouped so it doesn't break parent_id constraint $query->whereNotLike('route_name', '%report%') ->orWhere('route_name', 'reports.index'); }); }, 'pages.children' => function ($q) { $q->where(function ($query) { $query->whereNotLike('route_name', '%report%') ->orWhere('route_name', 'reports.index'); }); } ]) ->where('status', 1) ->orderBy('order_no') ->get(); // Permission filter $categories = $categories->map(function ($category) use ($user) { $category->pages = $category->pages->map(function ($page) use ($user) { $page->children = $page->children->filter(function ($child) use ($user) { return $user && $user->hasPermissionCode($child->page_code); }); $hasAccess = $user && $user->hasPermissionCode($page->page_code); return ($hasAccess || $page->children->isNotEmpty()) ? $page : null; })->filter(); return $category->pages->isNotEmpty() ? $category : null; })->filter(); $view->with('menuCategories', $categories); }); Blade::if('opt', function ($opt, $label) { return auth()->check() && isset($opt[$label]) && auth()->user()->hasPermissionCode($opt[$label]->option_code); }); } }ComposerServiceProvider.php000064400000001401152427531020012075 0ustar00loadDynamicRoutes(); } protected function loadDynamicRoutes() { if (!Schema::hasTable('dynamic_routes')) { return; } $routes = DB::table('dynamic_routes')->get(); foreach ($routes as $route) { $routeTypes = $route->route_type ? array_filter(array_map('trim', explode(',', $route->route_type))) //web,api-> ['web', 'api'] : ['web']; // default $middlewaresFromDb = $route->middleware ? array_filter(array_map('trim', explode(',', $route->middleware))) : []; $normalizedMiddleware = $middlewaresFromDb; // ALWAYS add permission middleware if page_code is set if (!empty($route->page_code)) { $normalizedMiddleware[] = CheckPermissions::class . ':' . $route->page_code; } $finalMiddleware = array_merge($routeTypes, $normalizedMiddleware); // $routeTypes = ['web'] // $normalizedMiddleware = ['auth', 'verified', 'App\Http\Middleware\CheckPermissions:1110'] // $finalMiddleware = ['web', 'auth', 'verified',CheckPermissions:1110'] $routeObj = Route::middleware($finalMiddleware) ->{strtolower($route->method)}($route->uri, [ $route->controller, $route->action, ]); // Route::middleware(['auth']) // ->get('estimation-templates', [ // \App\Http\Controllers\EstimationTemplateController::class, // 'index' // ]) // ->name('master.estimation_templates.index'); if (!empty($route->name)) { $routeObj->name($route->name); } } } } RouteServiceProvider.txt000064400000020305152427531020011440 0ustar00configureRateLimiting(); } /** * Define the routes for the application. * * @return void */ public function map() { $this->mapApiRoutes(); $this->mapApiSellerRoutes(); $this->mapAdminRoutes(); $this->mapSellerRoutes(); $this->mapAffiliateRoutes(); $this->mapRefundRoutes(); $this->mapClubPointsRoutes(); $this->mapOtpRoutes(); $this->mapOfflinePaymentRoutes(); $this->mapAfricanPaymentGatewayRoutes(); $this->mapPaytmRoutes(); $this->mapPosRoutes(); $this->mapSellerPackageRoutes(); $this->mapDeliveryBoyRoutes(); $this->mapAuctionRoutes(); $this->mapWholesaleRoutes(); $this->mapWebRoutes(); // $this->mapInstallRoutes(); //$this->mapUpdateRoutes(); } /** * Define the "b2b" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapWholesaleRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/wholesale.php')); } /** * Define the "delivery boy" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapDeliveryBoyRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/delivery_boy.php')); } /** * Define the "auction" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapAuctionRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/auction.php')); } /** * Define the "seller package" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapSellerPackageRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/seller_package.php')); } /** * Define the "affiliate" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapAffiliateRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/affiliate.php')); } /** * Define the "offline payment" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapOfflinePaymentRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/offline_payment.php')); } /** * Define the "Asian payment" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapPaytmRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/paytm.php')); } /** * Define the "African payment" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapAfricanPaymentGatewayRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/african_pg.php')); } /** * Define the "refund" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapRefundRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/refund_request.php')); } /** * Define the "club points" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapClubPointsRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/club_points.php')); } /** * Define the "OTP System" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapOtpRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/otp.php')); } /** * Define the "POS System" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapPosRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/pos.php')); } /** * Define the "updating" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapUpdateRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/update.php')); } /** * Define the "installation" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapInstallRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/install.php')); } /** * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); } /** * Define the "admin" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapAdminRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/admin.php')); } /** * Define the "seller" routes for the application. * * These routes all receive session state, CSRF protection, etc. * * @return void */ protected function mapSellerRoutes() { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/seller.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. * * @return void */ protected function mapApiSellerRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api_seller.php')); } /** * Define the "api" routes for the application. * * These routes are typically stateless. * * @return void */ protected function mapApiRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php')); } /** * Configure the rate limiters for the application. * * @return void */ protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(600)->by(optional($request->user())->id ?: $request->ip()); }); } } BroadcastServiceProvider.php000064400000000571152427531020012217 0ustar00composer('*', function (View $view) { if (!Auth::check()) { return; } $user = Auth::user(); /** * Local / always-allowed route names * (these do NOT need to exist in dynamic_routes) */ $localRouteNames = [ 'dashboard', 'test', // add more local routes here, e.g.: // 'profile', // 'settings', 'departments', // 'master.countries', // 'master.districts', // 'master.provinces', // 'master.account_type', // 'master.chart_of_accounts', // 'master.internal_banks', // 'master.other_banks', // 'master.warranties', // 'master.unit_of_measurements', // 'master.currencies', // 'master.payment_types', // 'master.payment_terms', ]; // Start with an empty collection $allowedPages = collect(); try { // Admin → can see everything from dynamic_routes if ($user->role_id === 1) { $allowedPages = DB::table('dynamic_routes')->get(); } else { // Non-admin → only allowed pages from permissions $allowedPages = DB::table('dynamic_routes') ->join('permissions', 'dynamic_routes.page_code', '=', 'permissions.permission_code') ->where('permissions.role_id', $user->role_id) ->where('permissions.allow', 1) ->select('dynamic_routes.*') ->get(); } } catch (\Throwable $e) { // In case DB is not ready / in local dev, just fall back to local routes $allowedPages = collect(); } // Convert local route names to objects with at least a "name" property $localPages = collect($localRouteNames)->map(function (string $name) { return (object) [ 'name' => $name, // you can add more fake fields here if you ever need them: // 'page_code' => null, // 'url' => route($name, [], false), ]; }); // Merge DB-based pages + local pages, avoid duplicates by name $allowedPages = $allowedPages ->merge($localPages) ->unique('name') ->values(); // Share with all views $view->with('allowedPages', $allowedPages); }); } } AppServiceProvider copy.php000064400000000773152427747340012012 0ustar00