D
D
DiGiTAll2017-09-15 17:45:26
Laravel
DiGiTAll, 2017-09-15 17:45:26

MiddleWare example in Laravel for handling UTM tags?

Please explain how to "get" to arbitrary parameters in the http request in order to be able to process them. For example, if a person goes to a page via a link with utm_tags, they need to be saved (to the session, cookies, or somewhere else) and redirect the person to the same page, but without parameters.
Those. I want to somehow get what is in $_REQUEST. We are talking about Laravel 5.3.

Here it is - throws out everything in general:

<?php

namespace App\Http\Middleware;

use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;

class CheckParams
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        $params = $request->route()->parameters();

        print_r($params);
        return $next($request);
    }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Mukovoz, 2017-09-15
@castomi

Everything is quite simple, you can use if to make a condition that for such and such a parameter, give such and such a cookie and that's it.
https://nginx.ru/ru/docs/http/ngx_http_rewrite_mod...
https://nginx.ru/ru/docs/http/ngx_http_core_module...
nginx.org/ru/docs/http/ngx_http_userid_module.html

A
Alexander Aksentiev, 2017-09-15
@Sanasol

$_GET same
https://stackoverflow.com/a/15081132

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question