Skip to content

Validation Error In Laravel 11 #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MusheAbdulHakim opened this issue Apr 16, 2024 · 2 comments
Open

Validation Error In Laravel 11 #50

MusheAbdulHakim opened this issue Apr 16, 2024 · 2 comments

Comments

@MusheAbdulHakim
Copy link

Call to undefined method Haruncpi\LaravelUserActivity\Controllers\ActivityController::validate().
I checked and reliazed the problem is coming from the handleData method of the ActivityController in your code.

$this->validate($request, [
            'action'    => 'required|string',
            'user_id'   => 'sometimes|numeric',
            'log_type'  => 'sometimes|string',
            'table'     => 'sometimes|string',
            'from_date' => 'sometimes|date_format:Y-m-d',
            'to_date'   => 'sometimes|date_format:Y-m-d'
        ]);

When I changed it to:

$request->validate([
            'action'    => 'required|string',
            'user_id'   => 'sometimes|numeric',
            'log_type'  => 'sometimes|string',
            'table'     => 'sometimes|string',
            'from_date' => 'sometimes|date_format:Y-m-d',
            'to_date'   => 'sometimes|date_format:Y-m-d'
        ]);

The problem was resolved. But for some other reason, I am not getting any log data in the UI.

@chitkoko-dec17
Copy link

chitkoko-dec17 commented Aug 22, 2024

Some code change in this functions handleCurrentData and handleUserAutocomplete. Sample like this

$this->validate($request, [

to

$request->validate([
            'table'  => 'required|string',
            'id'     => 'required',
            'log_id' => 'required|numeric'
        ]);
        
$request->validate([
            'user' => 'required|string|max:50'
        ]);

@haunv0609
Copy link

I also had the same problem. I temporarily turned off validate and it worked. Until the author fixes the bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants