Description
Extension Version
0.1.18
PHP Binary
Valet
Operating System
macOS
What happened?
All references to my policies using Gate::authorize()
give a 'not found' error message. The error message seems to indicate that the extension is looking for a policy with a name matching the method I'm trying to call on it.
E.g. this code in a controller:
Gate::authorize('update', $program);
Results in a lint (squiggly underline, no link/reference) with the message "Policy [update] not found."
My setup is completely vanilla in regards to auth/policies/controllers—Program
is a regular model, ProgramPolicy
exists in the default location and has an update
method, etc.
I can reproduce this in a new Laravel 11 app too after running php artisan make:policy UserPolicy --model=User
and php artisan make:controller UserController --model=User
and adding Gate::authorize('create', User::class);
.
Mimimal Code Sample
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
class UserController extends Controller
{
public function create()
{
Gate::authorize('create', User::class);
}
}