diff --git a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php index 04c1ad76..894f6562 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/GeneralManagerController.php @@ -23,6 +23,7 @@ use Illuminate\Support\Facades\DB; class GeneralManagerController extends Controller { use ApiResponse; + public function index(Request $request): JsonResponse { $query = Harim::query() @@ -58,6 +59,7 @@ class GeneralManagerController extends Controller 'state_name' => HarimStates::name($state), ]); }); + return $this->successResponse(); } @@ -192,11 +194,12 @@ class GeneralManagerController extends Controller 'state_name' => HarimStates::name($state), ]); }); + return $this->successResponse(); } + public function show(ShowRequest $request, Harim $harim): JsonResponse { return $this->successResponse($harim->load('histories')); - } } diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/ConstructionActivityController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/ConstructionActivityController.php index b8299e63..08919373 100644 --- a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/ConstructionActivityController.php +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/ConstructionActivityController.php @@ -19,7 +19,6 @@ class ConstructionActivityController extends Controller use ApiResponse; public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse { - $data = $operatorService->countryActivity(89); return $this->successResponse([ @@ -52,6 +51,4 @@ class ConstructionActivityController extends Controller $name = ' گزارش نگهداری حریم راه برای ساخت و ساز غیر مجاز' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; return Excel::download(new ConstructionReport($data, $request), $name); } - - } diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/UtilityPassingActivityController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/UtilityPassingActivityController.php index da3b9ed3..618fdbc4 100644 --- a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/UtilityPassingActivityController.php +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorReport/UtilityPassingActivityController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReport; use App\Exports\V3\SafetyAndPrivacy\Country\UtilityPassingReport as ExcelReport; use App\Exports\V3\SafetyAndPrivacy\Province\UtilityPassingReport; use App\Http\Controllers\Controller; +use App\Http\Traits\ApiResponse; use App\Models\EdarateShahri; use App\Models\Province; use App\Services\Cartables\SafetyAndPrivacy\OperatorService; @@ -15,9 +16,10 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse; class UtilityPassingActivityController extends Controller { + use ApiResponse; + public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse { - $data = $operatorService->countryActivity(91); return $this->successResponse([ @@ -50,5 +52,4 @@ class UtilityPassingActivityController extends Controller $name = 'گزارش نگهداری حریم راه برای عبور تاسیسات زیربنایی غیر مجاز ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; return Excel::download(new UtilityPassingReport($data, $request), $name); } - } diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php new file mode 100644 index 00000000..8b52b089 --- /dev/null +++ b/app/Providers/HorizonServiceProvider.php @@ -0,0 +1,34 @@ +username == 'witel'; + }); + } +} diff --git a/app/Services/Cartables/AccidentReceiptTableService.php b/app/Services/Cartables/AccidentReceiptTableService.php index 69ab80d3..45de66a6 100644 --- a/app/Services/Cartables/AccidentReceiptTableService.php +++ b/app/Services/Cartables/AccidentReceiptTableService.php @@ -57,7 +57,7 @@ class AccidentReceiptTableService SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi, SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final FROM `accidents` - where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" + where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" union SELECT province_fa, @@ -74,7 +74,7 @@ class AccidentReceiptTableService SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi, SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final FROM `accidents` - where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" + where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" GROUP BY province_id ' ); @@ -104,7 +104,7 @@ class AccidentReceiptTableService SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi, SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final FROM `accidents` - where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" AND province_id ='.$request->province_id.' + where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" AND province_id ='.$request->province_id.' union SELECT city_fa, @@ -121,7 +121,7 @@ class AccidentReceiptTableService SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi, SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final FROM `accidents` - where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" AND province_id ='.$request->province_id.' + where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" AND province_id ='.$request->province_id.' GROUP BY city_id ' ); diff --git a/bootstrap/cache/packages.php b/bootstrap/cache/packages.php index 58a2a104..1a06b457 100755 --- a/bootstrap/cache/packages.php +++ b/bootstrap/cache/packages.php @@ -28,6 +28,17 @@ 0 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider', ), ), + 'laravel/horizon' => + array ( + 'aliases' => + array ( + 'Horizon' => 'Laravel\\Horizon\\Horizon', + ), + 'providers' => + array ( + 0 => 'Laravel\\Horizon\\HorizonServiceProvider', + ), + ), 'laravel/pulse' => array ( 'aliases' => diff --git a/bootstrap/cache/services.php b/bootstrap/cache/services.php index da457a76..5a0bdb29 100755 --- a/bootstrap/cache/services.php +++ b/bootstrap/cache/services.php @@ -26,28 +26,29 @@ 22 => 'Barryvdh\\Debugbar\\ServiceProvider', 23 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider', 24 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider', - 25 => 'Laravel\\Pulse\\PulseServiceProvider', - 26 => 'Laravel\\Sail\\SailServiceProvider', - 27 => 'Laravel\\Sanctum\\SanctumServiceProvider', - 28 => 'Laravel\\Telescope\\TelescopeServiceProvider', - 29 => 'Laravel\\Tinker\\TinkerServiceProvider', - 30 => 'Laravel\\Ui\\UiServiceProvider', - 31 => 'Livewire\\LivewireServiceProvider', - 32 => 'Maatwebsite\\Excel\\ExcelServiceProvider', - 33 => 'Carbon\\Laravel\\ServiceProvider', - 34 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider', - 35 => 'Termwind\\Laravel\\TermwindServiceProvider', - 36 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider', - 37 => 'Spatie\\Permission\\PermissionServiceProvider', + 25 => 'Laravel\\Horizon\\HorizonServiceProvider', + 26 => 'Laravel\\Pulse\\PulseServiceProvider', + 27 => 'Laravel\\Sail\\SailServiceProvider', + 28 => 'Laravel\\Sanctum\\SanctumServiceProvider', + 29 => 'Laravel\\Telescope\\TelescopeServiceProvider', + 30 => 'Laravel\\Tinker\\TinkerServiceProvider', + 31 => 'Laravel\\Ui\\UiServiceProvider', + 32 => 'Livewire\\LivewireServiceProvider', + 33 => 'Maatwebsite\\Excel\\ExcelServiceProvider', + 34 => 'Carbon\\Laravel\\ServiceProvider', + 35 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider', + 36 => 'Termwind\\Laravel\\TermwindServiceProvider', + 37 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider', 38 => 'Spatie\\Permission\\PermissionServiceProvider', - 39 => 'App\\Providers\\AppServiceProvider', - 40 => 'App\\Providers\\AuthServiceProvider', - 41 => 'App\\Providers\\EventServiceProvider', - 42 => 'App\\Providers\\RouteServiceProvider', - 43 => 'App\\Providers\\TelescopeServiceProvider', - 44 => 'Barryvdh\\Debugbar\\ServiceProvider', - 45 => 'App\\Providers\\DataTableServiceProvider', - 46 => 'App\\Providers\\FileServiceProvider', + 39 => 'Spatie\\Permission\\PermissionServiceProvider', + 40 => 'App\\Providers\\AppServiceProvider', + 41 => 'App\\Providers\\AuthServiceProvider', + 42 => 'App\\Providers\\EventServiceProvider', + 43 => 'App\\Providers\\RouteServiceProvider', + 44 => 'App\\Providers\\TelescopeServiceProvider', + 45 => 'Barryvdh\\Debugbar\\ServiceProvider', + 46 => 'App\\Providers\\DataTableServiceProvider', + 47 => 'App\\Providers\\FileServiceProvider', ), 'eager' => array ( @@ -64,26 +65,27 @@ 10 => 'Barryvdh\\Debugbar\\ServiceProvider', 11 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider', 12 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider', - 13 => 'Laravel\\Pulse\\PulseServiceProvider', - 14 => 'Laravel\\Sanctum\\SanctumServiceProvider', - 15 => 'Laravel\\Telescope\\TelescopeServiceProvider', - 16 => 'Laravel\\Ui\\UiServiceProvider', - 17 => 'Livewire\\LivewireServiceProvider', - 18 => 'Maatwebsite\\Excel\\ExcelServiceProvider', - 19 => 'Carbon\\Laravel\\ServiceProvider', - 20 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider', - 21 => 'Termwind\\Laravel\\TermwindServiceProvider', - 22 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider', - 23 => 'Spatie\\Permission\\PermissionServiceProvider', + 13 => 'Laravel\\Horizon\\HorizonServiceProvider', + 14 => 'Laravel\\Pulse\\PulseServiceProvider', + 15 => 'Laravel\\Sanctum\\SanctumServiceProvider', + 16 => 'Laravel\\Telescope\\TelescopeServiceProvider', + 17 => 'Laravel\\Ui\\UiServiceProvider', + 18 => 'Livewire\\LivewireServiceProvider', + 19 => 'Maatwebsite\\Excel\\ExcelServiceProvider', + 20 => 'Carbon\\Laravel\\ServiceProvider', + 21 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider', + 22 => 'Termwind\\Laravel\\TermwindServiceProvider', + 23 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider', 24 => 'Spatie\\Permission\\PermissionServiceProvider', - 25 => 'App\\Providers\\AppServiceProvider', - 26 => 'App\\Providers\\AuthServiceProvider', - 27 => 'App\\Providers\\EventServiceProvider', - 28 => 'App\\Providers\\RouteServiceProvider', - 29 => 'App\\Providers\\TelescopeServiceProvider', - 30 => 'Barryvdh\\Debugbar\\ServiceProvider', - 31 => 'App\\Providers\\DataTableServiceProvider', - 32 => 'App\\Providers\\FileServiceProvider', + 25 => 'Spatie\\Permission\\PermissionServiceProvider', + 26 => 'App\\Providers\\AppServiceProvider', + 27 => 'App\\Providers\\AuthServiceProvider', + 28 => 'App\\Providers\\EventServiceProvider', + 29 => 'App\\Providers\\RouteServiceProvider', + 30 => 'App\\Providers\\TelescopeServiceProvider', + 31 => 'Barryvdh\\Debugbar\\ServiceProvider', + 32 => 'App\\Providers\\DataTableServiceProvider', + 33 => 'App\\Providers\\FileServiceProvider', ), 'deferred' => array ( diff --git a/composer.json b/composer.json index 8d9ff456..a2345809 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "guzzlehttp/guzzle": "^7.2", "hekmatinasser/verta": "^8.3", "laravel/framework": "^10.10", + "laravel/horizon": "^5.33", "laravel/pulse": "^1.0@beta", "laravel/sanctum": "^3.2", "laravel/telescope": "^4.17", diff --git a/composer.lock b/composer.lock index 0388dc70..2928ac05 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bf9b86b55591e7c7df84cb1be8ea9db3", + "content-hash": "379d6ba4ded00ca7079f26aa5b12e04e", "packages": [ { "name": "beberlei/assert", @@ -1949,6 +1949,86 @@ }, "time": "2024-01-30T16:25:02+00:00" }, + { + "name": "laravel/horizon", + "version": "v5.33.3", + "source": { + "type": "git", + "url": "https://github.com/laravel/horizon.git", + "reference": "aabcd425b34005182acc4c22aae48692684cb765" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/horizon/zipball/aabcd425b34005182acc4c22aae48692684cb765", + "reference": "aabcd425b34005182acc4c22aae48692684cb765", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcntl": "*", + "ext-posix": "*", + "illuminate/contracts": "^9.21|^10.0|^11.0|^12.0", + "illuminate/queue": "^9.21|^10.0|^11.0|^12.0", + "illuminate/support": "^9.21|^10.0|^11.0|^12.0", + "nesbot/carbon": "^2.17|^3.0", + "php": "^8.0", + "ramsey/uuid": "^4.0", + "symfony/console": "^6.0|^7.0", + "symfony/error-handler": "^6.0|^7.0", + "symfony/polyfill-php83": "^1.28", + "symfony/process": "^6.0|^7.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "phpstan/phpstan": "^1.10|^2.0", + "phpunit/phpunit": "^9.0|^10.4|^11.5|^12.0", + "predis/predis": "^1.1|^2.0|^3.0" + }, + "suggest": { + "ext-redis": "Required to use the Redis PHP driver.", + "predis/predis": "Required when not using the Redis PHP driver (^1.1|^2.0|^3.0)." + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Horizon": "Laravel\\Horizon\\Horizon" + }, + "providers": [ + "Laravel\\Horizon\\HorizonServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Horizon\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Dashboard and code-driven configuration for Laravel queues.", + "keywords": [ + "laravel", + "queue" + ], + "support": { + "issues": "https://github.com/laravel/horizon/issues", + "source": "https://github.com/laravel/horizon/tree/v5.33.3" + }, + "time": "2025-08-11T14:55:49+00:00" + }, { "name": "laravel/prompts", "version": "v0.1.15", diff --git a/config/app.php b/config/app.php index 43214a21..699fea14 100644 --- a/config/app.php +++ b/config/app.php @@ -177,6 +177,7 @@ return [ App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, + App\Providers\HorizonServiceProvider::class, App\Providers\RouteServiceProvider::class, App\Providers\TelescopeServiceProvider::class, Barryvdh\Debugbar\ServiceProvider::class, diff --git a/config/horizon.php b/config/horizon.php new file mode 100644 index 00000000..8b1f9e44 --- /dev/null +++ b/config/horizon.php @@ -0,0 +1,214 @@ + env('HORIZON_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Horizon Path + |-------------------------------------------------------------------------- + | + | This is the URI path where Horizon will be accessible from. Feel free + | to change this path to anything you like. Note that the URI will not + | affect the paths of its internal API that aren't exposed to users. + | + */ + + 'path' => env('HORIZON_PATH', 'horizon'), + + /* + |-------------------------------------------------------------------------- + | Horizon Redis Connection + |-------------------------------------------------------------------------- + | + | This is the name of the Redis connection where Horizon will store the + | meta information required for it to function. It includes the list + | of supervisors, failed jobs, job metrics, and other information. + | + */ + + 'use' => 'default', + + /* + |-------------------------------------------------------------------------- + | Horizon Redis Prefix + |-------------------------------------------------------------------------- + | + | This prefix will be used when storing all Horizon data in Redis. You + | may modify the prefix when you are running multiple installations + | of Horizon on the same server so that they don't have problems. + | + */ + + 'prefix' => env( + 'HORIZON_PREFIX', + Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:' + ), + + /* + |-------------------------------------------------------------------------- + | Horizon Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will get attached onto each Horizon route, giving you + | the chance to add your own middleware to this list or change any of + | the existing middleware. Or, you can simply stick with this list. + | + */ + + 'middleware' => ['web'], + + /* + |-------------------------------------------------------------------------- + | Queue Wait Time Thresholds + |-------------------------------------------------------------------------- + | + | This option allows you to configure when the LongWaitDetected event + | will be fired. Every connection / queue combination may have its + | own, unique threshold (in seconds) before this event is fired. + | + */ + + 'waits' => [ + 'redis:default' => 60, + ], + + /* + |-------------------------------------------------------------------------- + | Job Trimming Times + |-------------------------------------------------------------------------- + | + | Here you can configure for how long (in minutes) you desire Horizon to + | persist the recent and failed jobs. Typically, recent jobs are kept + | for one hour while all failed jobs are stored for an entire week. + | + */ + + 'trim' => [ + 'recent' => 60, + 'pending' => 60, + 'completed' => 60, + 'recent_failed' => 10080, + 'failed' => 10080, + 'monitored' => 10080, + ], + + /* + |-------------------------------------------------------------------------- + | Silenced Jobs + |-------------------------------------------------------------------------- + | + | Silencing a job will instruct Horizon to not place the job in the list + | of completed jobs within the Horizon dashboard. This setting may be + | used to fully remove any noisy jobs from the completed jobs list. + | + */ + + 'silenced' => [ + // App\Jobs\ExampleJob::class, + ], + + /* + |-------------------------------------------------------------------------- + | Metrics + |-------------------------------------------------------------------------- + | + | Here you can configure how many snapshots should be kept to display in + | the metrics graph. This will get used in combination with Horizon's + | `horizon:snapshot` schedule to define how long to retain metrics. + | + */ + + 'metrics' => [ + 'trim_snapshots' => [ + 'job' => 24, + 'queue' => 24, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Fast Termination + |-------------------------------------------------------------------------- + | + | When this option is enabled, Horizon's "terminate" command will not + | wait on all of the workers to terminate unless the --wait option + | is provided. Fast termination can shorten deployment delay by + | allowing a new instance of Horizon to start while the last + | instance will continue to terminate each of its workers. + | + */ + + 'fast_termination' => false, + + /* + |-------------------------------------------------------------------------- + | Memory Limit (MB) + |-------------------------------------------------------------------------- + | + | This value describes the maximum amount of memory the Horizon master + | supervisor may consume before it is terminated and restarted. For + | configuring these limits on your workers, see the next section. + | + */ + + 'memory_limit' => 64, + + /* + |-------------------------------------------------------------------------- + | Queue Worker Configuration + |-------------------------------------------------------------------------- + | + | Here you may define the queue worker settings used by your application + | in all environments. These supervisors and settings handle all your + | queued jobs and will be provisioned by Horizon during deployment. + | + */ + + 'defaults' => [ + 'supervisor-1' => [ + 'connection' => 'redis', + 'queue' => ['default'], + 'balance' => 'auto', + 'autoScalingStrategy' => 'time', + 'maxProcesses' => 1, + 'maxTime' => 0, + 'maxJobs' => 0, + 'memory' => 128, + 'tries' => 2, + 'timeout' => 60, + 'nice' => 0, + 'backoff' => 10, + ], + ], + + 'environments' => [ + 'production' => [ + 'supervisor-1' => [ + 'maxProcesses' => 10, + 'balanceMaxShift' => 1, + 'balanceCooldown' => 3, + ], + ], + + 'local' => [ + 'supervisor-1' => [ + 'maxProcesses' => 3, + ], + ], + ], +];