GithubHelp home page GithubHelp logo

Comments (17)

evolucionaurea avatar evolucionaurea commented on May 23, 2024 1

Sorry, I was dealing with a lot of things at the same time. I must not have seen her.
Thank you so much!

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

Describe the behaviour you're experiencing. Do not just copy and paste a random error message and expect help.
List all the steps needed to reproduce the issue you're having.
Make sure to include code (affected models, configuration, ...).
Pastebins, screenshots and/or other resources that may help us understand what's going on, will also be appreciated.
In a nutshell, help us, help you.

You give too much information to investigate.

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

Versions:
PHP: 8.1
owen-it/laravel-auditing: "^13.5"

image

Vendor Folder:
The package is installed correctly

image

Config
In config/app.php

image

My error:
VisualStudio tells me an error in a Model
image

Tests I did
I have a seeder to create a "Solicitud".
When I run the seeder it only records in the "Solicitud" table but not in Audit

image image

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

Config
In config/app.php

It is not necessary to add that line in the config file, the package uses autodiscover

Try composer du on console

When I run the seeder it only records in the "Solicitud"

maybe it is not designed to work from seeder
seeder uses insert(), and insert has no event, only create() is audited

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

1) Delete the line in providers

image

2) This is my Seeder:
image

3) I run composer dump-autoload ok

4) Does not save in the audits table
image

5) The warning still appears in the model
image

6) Could it be that Audit is not compatible with PHP 8.1?
image

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

In my Seeder try "Insert" but it doesn't work either

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

Could it be that Audit is not compatible with PHP 8.1?

I'm using it on 8.1, 8.2, and everything works, but i never try to audit seeders

VisualStudio tells me an error in a Model

That looks like another problem.

from laravel-auditing.

erikn69 avatar erikn69 commented on May 23, 2024

do you have audit.console => true?

if (App::runningInConsole()) {
return Config::get('audit.enabled', true) && Config::get('audit.console', false);
}

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

I was doing tests.
Apparently it doesn't work with seeders but using postman it works fine!

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

thank you so much

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

Hi.
I leave an image of how I managed to make it work.
In the seeder I tried "insert" and "create" but it didn't work.
Creating a new instance of the model and using the "save()" function worked correctly

image

Bye

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

@evolucionaurea did you try $cliente->fill($request->all());, if you have 100 properties and if you do it one at a time, it will take you a lot

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

Yeah.
I see that from the controller it always works fine.
Using insert() or create() works correctly.

The Seeder is where it doesn't work.

In controller this is ok:
$cliente = Cliente::findOrFail($id);
$cliente->update($data);

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

do you have audit.console => true?

That didn't work either?

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

Hi.
There I set console to true and now they work correctly with the seeders.
Thank you!

image image

from laravel-auditing.

parallels999 avatar parallels999 commented on May 23, 2024

They had given you that answer a long time ago, it seems that you deliberately ignored it. 😄

| Whether console events should be audited (eg. php artisan db:seed).

from laravel-auditing.

evolucionaurea avatar evolucionaurea commented on May 23, 2024

Hello.
Sorry for the inconvenience.
I have a problem with sql server saving dates. I solved it this way.

My migration:
image

My model:
image

My seeder:
image

The problem is that the models that have Laravel Auditing give an error when saving.
How do I configure it to accept the date format (Y-d-m H:i:s) in SQL SERVER?

SQLSTATE[22007]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]La conversión del tipo de datos nvarchar en datetime produjo un valor fuera de intervalo. (Connection: sqlsrv, SQL: insert into [audits] ([old_values], [new_values], [event], [auditable_id], [auditable_type], [user_id], [user_type], [tags], [ip_address], [user_agent], [url], [updated_at], [created_at]) values ([], {"nombre":"Naldo Lombardi","codigo":"2jk5eg8","razon_social":"Naldo Lombardi SA","id_pais":1,"id":1}, created, 1, App\Models\Cliente, ?, ?, ?, 127.0.0.1, Symfony, console, 2023-10-19 09:51:32.161, 2023-10-19 09:51:32.161))

from laravel-auditing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.