mardi 25 juin 2019

How to save data like prevURL, currentURL at page load?

I am building a page tracking module in Laravel 5, and hoping to save the following data 1) previous URL 2) current URL 3) IP address (if there is a built in helper in laravel)

I have tried the following but it is simply writing a new record instead of storing anything.

In my view file

<input type="hidden" name="prevURL" id="prevURL" value="URL::previous">

Also tried (as per laravel tutorial)

session(['key' => 'value']);

In my controller, i wrote

    $appdownload = new Appdownload();
    $appdownload->prevURL = session('prevURL');
    $appdownload->save();
    return view("deals." . $title);

The expectation is that I will have records of page visiting 1) current url 2) prev URL 3) date and time (using current timestamp in mysql, so not an issue) 4) track IP if there are any built in library.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire