tattersoftware / codeigniter4-audits

Lightweight object logging for CodeIgniter 4
MIT License
13 stars 6 forks source link

How can I use Audits on codeigniter4/shield? #21

Open d4f3dQnK opened 1 year ago

d4f3dQnK commented 1 year ago

My Audits Config like this:

<?php

namespace Config;

use Tatter\Audits\Config\Audits as AuditsConfig;

class Audits extends AuditsConfig
{
    // Session key in that contains the integer ID of a logged in user
    public $sessionUserId = 'user_id';

    // Whether to continue instead of throwing exceptions
    public $silent = true;
}

And I can't get the user_id from session with Shield package. How can I fix this? Thank you.


Ci4 Ver.: 4.3.0 Audits Ver.: 1.1..3 Shield Ver.: 1.0.0-beta.6

d4f3dQnK commented 1 year ago

I can't find a way to fix this...

MGatner commented 1 year ago

I've been moving away from this approach to getting the current user and will update this package to use the CodeIgniter-approved Auth guidelines.

warcooft commented 4 months ago

Hi @MGatner, thanks for your effort creating this beautiful module. is there any new update regarding this issue? i also faced the same problem can not getting user_id from app/Config/Audits.php

when I try to modify it like this

Screenshot 2024-05-16 at 17 29 39

the user_id can be recorded but how can I make this more flexible with a separate config like above?

MGatner commented 4 months ago

@warcooft your change is exactly the kind I had in mind. If you would like to send a Pull Request that could get the update process started.

warcooft commented 4 months ago

sure, I'll be happy to send PR. Thanks