classify admin

This commit is contained in:
Husanjonazamov
2026-02-24 12:52:01 +05:00
commit e0f1989655
769 changed files with 1263008 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider {
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot() {
$this->registerPolicies();
// Implicitly grant "Super Admin" role all permissions
// This works in the app by using gate-related functions like auth()->user->can() and @can()
Gate::before(static function ($user, $ability) {
return $user->hasRole('Super Admin') ? true : null;
});
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider {
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot() {
//
}
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents() {
return false;
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider {
/**
* The path to the "home" route for your application.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*
* @return void
*/
public function boot() {
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting() {
RateLimiter::for('api', static function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace App\Providers;
use App\Models\Language;
use App\Models\Setting;
use App\Services\CachingService;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class ViewServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
/*** Header File ***/
// View::composer('layouts.topbar', static function ($view) {
// $languages = CachingService::getLanguages();
// // $defaultLanguage = CachingService::getDefaultLanguage();
// $settings = CachingService::getSystemSettings();
// // $currentLanguageCode = ::get('language');
// $defaultLanguage = Setting::where('name', 'default_language')->first();
// // $currentLanguageCode = Setting::where('name', 'default_language')->first();
// $currentLanguage = Language::where('code', Session::get('locale'))->first();
// Session::put('language', $defaultLanguage);
// $view->with([
// 'languages' => $languages,
// 'defaultLanguage' => $defaultLanguage,
// 'currentLanguage' => $currentLanguage,
// 'settings' => $settings
// ]);
// });
View::composer('layouts.topbar', function ($view) {
$languages = CachingService::getLanguages();
// Always get the most recent default from DB
$defaultLangCode = Setting::where('name', 'default_language')->value('value') ?? 'en';
$defaultLanguage = $languages->where('code', $defaultLangCode)->first();
// If session is empty, use the database default
$currentLocale = Session::get('locale', $defaultLangCode);
$currentLanguage = $languages->where('code', $currentLocale)->first();
$view->with([
'languages' => $languages,
'defaultLanguage' => $defaultLanguage, // Now correctly shows the DB value
'currentLanguage' => $currentLanguage,
'settings' => CachingService::getSystemSettings()
]);
});
View::composer('layouts.sidebar', static function (\Illuminate\View\View $view) {
$settings = CachingService::getSystemSettings('company_logo');
$view->with('company_logo', $settings ?? '');
});
View::composer('layouts.main', static function (\Illuminate\View\View $view) {
$settings = CachingService::getSystemSettings('favicon_icon');
$view->with('favicon', $settings ?? '');
$view->with('lang', Session::get('language'));
});
View::composer('auth.login', static function (\Illuminate\View\View $view) {
$favicon_icon = CachingService::getSystemSettings('favicon_icon');
$company_logo = CachingService::getSystemSettings('company_logo');
$login_image = CachingService::getSystemSettings('login_image');
$view->with('company_logo', $company_logo ?? '');
$view->with('favicon', $favicon_icon ?? '');
$view->with('login_bg_image', $login_image ?? '');
});
}
/**
* Bootstrap services.
*/
public function boot(): void
{
//
}
}