File: D:/HostingSpaces/SBogers10/rentman2019.komma.pro/app/Http/Wildcards/IntegrationsWildcard.php
<?php
namespace App\Http\Wildcards;
use App\Komma\Integrations\Models\IntegrationTranslation;
class IntegrationsWildcard implements WildcardInterface
{
/**
* @param $request
* @param $wildcard
* @return mixed
*/
public function handle($request, $wildcard)
{
// Check if the first segment is found in the PostTranslation
// If PostTranslation isn't found then send to the filters method
if (count($wildcard->tail) == 1 && $postTranslation = IntegrationTranslation::where('slug', $wildcard->tail[0])->first()) {
//Set the request URI and the original path
$request->server->set('REQUEST_URI', 'integrations/'.$postTranslation->integration_id);
return $request;
}
// Bind filters to the request and set uri to the filter function of the post controller
// $request->merge(['filters' => $wildcard->tail]);
//Set the request URI and the original path
// $request->server->set('REQUEST_URI', 'integrations/filters');
return $request;
}
}