2 months ago

Input request

Posted 2 months ago by KarolGil


Is it possible to sign the protected property of an object?

    public function handle($request, Closure $next)
        if ($request->filled('lang')) {
            $tmpRow = TableName::where('locale', '=', $request->input('lang') )->first();
            if ( !$tmpRow ) {
                $request->lang = config('global.default_locale');

        return $next($request);

I mean checking if the 'lang' parameter value is one of the values given in the database, and if not to change the value in the request to the default language of the page. I wanted to do this through midellware that it worked globally, not that I had to overwrite every method on the site.

Please sign in or create an account to participate in this conversation.