php - Laravel can authorization with Gate doesn't work -


i have in view:

@can('sendmessage', $uzytkownik)         <div class="mt-3 mb-3 text-center">             <a class="btn-primary pointer btn">                 wyślij prywatną wiadomość             </a>         </div> @endcan 

and in authserviceprovider

gate::define('sendmessage', function($user, $to)         {             return 1;             //return $to->id !== $user->id , $to->status === 1;         }); 

//return 1; testing why doesn't work... can't find out.

button isn't seen although have return 1;, should visible.

when change can @can('sendmessage') have error, - few arguments.

so see , work it

i , change can @can('sendmessage') , gate gate::define('sendmessage', function($user)

now works, , button seen...

what going on here? when got 2 arg doesn't work properly

although $to thing send in view $uzytkownik proper users eloquent model. should work

{{ dd(\illuminate\support\facades\gate::check('sendmessage', $uzytkownik)) }} gives 'false'... got return 1. going on > . >

{{ dd(\illuminate\support\facades\gate::check('sendmessage', auth()->user(), $uzytkownik)) }} gives false too.

all on return 1, false.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -