59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?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);
|
||
}
|
||
|
||
}
|