HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/rentman2019.komma.pro/app/Http/Wildcards/SolutionsWildcard.php
<?php

namespace App\Http\Wildcards;

use App\Komma\Shop\Products\Product\ProductTranslation;
use App\Komma\Solutions\Models\SolutionTranslation;

class SolutionsWildcard implements WildcardInterface
{
    /**
     * @param $request
     * @param $wildcard
     * @return mixed
     */
    public function handle($request, $wildcard)
    {
        // Check if the first segment is found in the ProductTranslation
        // If ProductTranslation isn't found then send to the filters method
        if (count($wildcard->tail) == 1 && $solutionTranslation = SolutionTranslation::where('slug', $wildcard->tail[0])->first()) {
            //Set the request URI and the original path
            $request->server->set('REQUEST_URI', 'solutions/'.$solutionTranslation->solution_id);

            return $request;
        }

        // Bind filters to the request and set uri to the filter function of the product controller
//        $request->merge(['filters' => $wildcard->tail]);

        //Set the request URI and the original path
//        $request->server->set('REQUEST_URI', 'products/filters');

        return $request;
    }
}