File: D:/HostingSpaces/SBogers95/rentman.io/app/Http/Wildcards/CareersJobsWildcard.php
<?php
namespace App\Http\Wildcards;
use App\Komma\CareersJobs\Models\CareersJob;
class CareersJobsWildcard implements WildcardInterface
{
/**
* @param $request
* @param $wildcard
* @return mixed
*/
public function handle($request, $wildcard)
{
// Check if the first segment is found in the JobTranslation
// If JobTranslation isn't found then send to the filters method
if ($jobTranslation = CareersJob::where('slug', $wildcard->tail[0])->first()) {
//Set the request URI and the original path
$request->server->set('REQUEST_URI', 'careersJobs/'.$jobTranslation->id);
return $request;
}
return $request;
}
}