shetabit / visitor

a laravel package to work with visitors and retrieve their informations
MIT License
527 stars 68 forks source link

Can i use shetabit_visits table to log automatically without passing model as parameter? #25

Closed djjatoro closed 3 years ago

djjatoro commented 3 years ago

Hi.

I have a Laravel web. Only a Landing or Portfolio page. No tables are necesary

Controllers/WelcomeController.php

public function index()
{
    return view('pages.welcome');
}

Routes/web.php

Route::middleware(['visitors'])->get('/','App\Http\Controllers\WelcomeController@index');

I would like to store in a table to keep a record of the information of each visitor of my page.

Actually i obtain error "_method_exists(): Argument #1 ($object_orclass) must be of type object|string, null given", because, i think, i didn´t use visitable Eloquent models using Visitable trait. I'm right?

If so, could you please tell me if the "shetabit_visits" table could be used directly to store these records or would it be necessary to create a new table?

In this case, could you please give me any recommendations on creating an auxiliary table to store the records, the necessary fields?

In any case, I think it would be useful for cases like mine to include these explanations in the documentation or add the utility of saving the information without having to pass a model to it.

I'm waiting for your response.

Thanks in advance.

khanzadimahdi commented 3 years ago

Hi, in this package we can store model logs. currently, we are not able to store custom logs. However, you can add this feature and send a pull request.

khanzadimahdi commented 3 years ago

I add this to my TODO list for the next version.

mohamedsabil83 commented 3 years ago

Hi @djjatoro, If I understand your problem, then I fix the issue you faced and @khanzadimahdi just merged my PR and made a new version. Try to update to the latest version and try again.

djjatoro commented 3 years ago

Hi @djjatoro, If I understand your problem, then I fix the issue you faced and @khanzadimahdi just merged my PR and made a new version. Try to update to the latest version and try again.

Thank you very much @mohamedsabil83 for answering my request.

The truth is that I wanted to have tried to implement this feature myself, but I am very busy with the creation of my own company as a freelance professional for websites, ecommerce..., SEO, SEM of the page, social networks, etc.

The update is fantastic and works perfectly. Hope it is useful to more people.

Perhaps another feature that could be interesting would be the possibility of excluding ips for the creation of logs, for example, when I visit the page from my home network, mobile, the ips of my friends, employees, etc.

And, once again, thank you for your time. Have a happy weekend.

mohamedsabil83 commented 3 years ago

Glad to hear that @djjatoro and good luck with your company.

I have many ideas to discuss with @khanzadimahdi to improve this package and add extra useful features for it but after finishing some projects nowadays.