3 years ago

Cannot get Ability to return true

Posted 3 years ago by cullymason

I am basically trying to set up an ability for a user to open and close a ticket . The logic is pretty simple, if the ticket is owned by the user, then you can open and close it. On a view, I want the Close Ticket button to only show when the ticket can be closed.

here are by abilities defined in the AuthServiceProvider

            return $user->id===$ticket->owner_id;

            return $user->id === $ticket->owner_id;

In my view, I have

 <a href="/tickets/{{$ticket->id}}/close" id="close-ticket-button" class="btn btn-danger-outline btn-block">Close Ticket</a>

And the button never shows. I have checked the Database to make sure it is true. Then I simply changed the ability so it always returns true like this :

            return true;

And I get the same thing. Any ideas?

Please sign in or create an account to participate in this conversation.