Random 404 error

I am having a weird problem. I have a button on my page that allows users to access a job. depending on the job they want to access a 404 error appears

im using livewire 2.4

The code only verifies if the user is logged in, and if it is not, a modal shows, in that part of the code is where the problem is giving

public $errores = [];
public $success; 

public function apply(VacanteModel $vacante)
    {
        if (auth()->check()) {
               /* .... */
        } else {
            array_push($error, 'You have to log in to your account to apply');
        }

            $this->errores = '';
            $this->errores = $error;
            $this->success = '';
}

and in my view the code is:

<button wire:click="apply(4512412368)" >
        Apply
    </button>

Hi,
Can you try without type hinted?
that should solve your problem, I think that’s your problem, cause you are sending a number and that method is expecting a VacanteModel Type.

Also, I think that the best way is putting that component in a protected route so you don’t to check every time is the user is authenticated

1 Like