Extension Version
0.1.20
PHP Binary
Valet
Operating System
macOS
What happened?
Possibly related to #225.
Policy references are not linked when passing Gate::authorize() a model instance.
This works, create is linked to the expected class, ProgramPolicy:
Gate::authorize('create', Program::class)
This doesn't work, there's no link ($program is a Program model instance):
Gate::authorize('update', $program)
Vanilla setup, Program is a regular model, ProgramPolicy exists in the default location and has an update method with the default type hints, etc. Reproduced in two different apps.
Mimimal Code Sample
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
class UserController extends Controller
{
public function update(User $user)
{
Gate::authorize('update', $user);
}
}