crud
crud copied to clipboard
Call to a member function can() on null
I have custom action for bulk deleting records.
public function handle(Collection $models)
{
$models->each(function (Model $model) {
$model->delete();
event(new MyEvent$model));
});
Toast::message('Custom message');
}
Action seems to be completed, because selected rows are being deleted, but after that I get error Call to a member function can() on null
. It's caused by line 80 in orchid\crud\src\CrudScreen.php
:
protected function can(string $abilities, Model $model = null): bool
{
return $this->request->can($abilities, $model);
}
Am I doing something wrong? I use custom authentication with Fortify and LDAP, but I don't think it's related to that.
Error share on Flare: https://flareapp.io/share/yPa9EnYP
@m-pastuszek I ran into the same issue. Since my admin panel is only for one admin user and not for regular users and thus the permissions are not a problem for me I just set in CrudScreen line 80 return true
. It does the job for me, but I highly do not recommend doing so since it will always allow you to do the action. The issue is not present in Laravel 9 and the corresponding orchid versions, but I am running Laravel 10 so downgrading is not an option. I will check into the issue when I have some more time to investigate.
Okay, thank you for information. So it's related to custom authentication?
It should be fixed with the release of https://github.com/orchidsoftware/crud/releases/tag/4.2.0, please update.