Files
api-extranetwork/app/Http/Middleware/CheckPropertyChannelConnectionMiddleware.php
ExtraNetwork e5c4b6aa13 first commit
2026-05-12 17:04:54 +03:00

59 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Http\Middleware;
use App\Core\Service\PropertyChannelMappingService;
use Closure;
use Exception;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class CheckPropertyChannelConnectionMiddleware
{
private $propertyChannelMappingService;
private $request;
private $response;
public function __construct(
Request $request,
Response $response,
PropertyChannelMappingService $propertyChannelMappingService
)
{
$this->propertyChannelMappingService = $propertyChannelMappingService;
$this->request = $request;
$this->response = $response;
}
public function handle($request, Closure $next, $guard = null)
{
//TODO: Buraya kanal (channel_id) ve kanal grupları (channel_group_id) için property için bir kontrol koyulacak
//dd($this->request->params['property_id']);
/*$response = $next($request);
$propertyId = $request->property_id ? $request->property_id : fillOnUndefined($request->params, 'property_id');
$channelId = fillOnUndefined($request->params, 'channel_id');
$checkParams = [
'property_id' => $propertyId,
'channel_id' => $channelId,
] ;
$checkMappingStatus =$this->propertyChannelMappingService->checkPropertyChannelMapping($checkParams);
if ($checkMappingStatus['status'] != 'success') {
return apiResponse(false, $checkMappingStatus['message'], null, 400);
}
return $response;*/
return $next($request);
}
}