blade:
@can('see_similar', $similar, $in_pair)
...
@endcan
class AuthServiceProvider extends ServiceProvider:
public function boot()
{
$this->registerPolicies();
Gate::define('see_similar', function ($user, $similar, $in_pair) {
return count($similar) > 0 && (isset($in_pair)) && $in_pair !== 'in_pair';
});
}
It gives me this error:
Too few arguments to function App\Providers\AuthServiceProvider::App\Providers{closure}(), 2 passed in /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 452 and exactly 3 expected (View: /var/www/html/resources/views/daters.blade.php)
Though it works if I pass just one argument "...function($user, $similar)" for example. I tried to pass an array of args, didn't work.
Please explain to me how can I pass several arguments.