File: D:/HostingSpaces/SBogers10/slenders.komma.pro/app/Http/Wildcards/MmhWildcard.php
<?php
namespace App\Http\Wildcards;
use App\Komma\MonthlyMustHaves\Models\MonthlyMustHaveTranslation;
class MmhWildcard implements WildcardInterface
{
/**
* @param $request
* @param $wildcard
* @return mixed
*/
public function handle($request, $wildcard)
{
// Check if the first segment is found in the MonthlyMustHaveTranslation
// If MonthlyMustHaveTranslation isn't found then send to the filters method
if($mmhTranslation = MonthlyMustHaveTranslation::where('slug', $wildcard->tail[0])->first())
{
//Set the request URI and the original path
$request->server->set('REQUEST_URI', 'mmh/'.$mmhTranslation->monthly_must_have_id);
return $request;
}
return $request;
}
}