0

I have a very basic policy

<?php

namespace App\Policies;

use App\Models\Comment;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class CommentPolicy
{
    use HandlesAuthorization;

    public function update(User $user, Comment $comment)
    {
        return true;
    }
}

I call it in a view

@can('update', $comment)
Edit
@endcan

I register it

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        App\Models\Comment::class => App\Policies\CommentPolicy::class,
    ];

Even though it should always show because I've hardcoded true, nothing shows

Lee
  • 131
  • 3
  • 9

1 Answers1

0
class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        \App\Models\Comment::class => \App\Policies\CommentPolicy::class,
    ];

I forgot the backslashes at the beginning

Lee
  • 131
  • 3
  • 9