Php 如何定义Laravel 6上的门
我想定义一个门,但我不知道为什么不工作,知道吗 我试图在define上显示dd(),但没有显示dd()消息,重定向到页面“403此操作未经授权。” 拉威尔6号 PHP7.3 已经看过医生了吗 这是我的AuthServiceProvider和Controller AuthServiceProviderPhp 如何定义Laravel 6上的门,php,laravel,laravel-6,Php,Laravel,Laravel 6,我想定义一个门,但我不知道为什么不工作,知道吗 我试图在define上显示dd(),但没有显示dd()消息,重定向到页面“403此操作未经授权。” 拉威尔6号 PHP7.3 已经看过医生了吗 这是我的AuthServiceProvider和Controller AuthServiceProvider <?php namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Models' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Gate::define('isAdmin', function ($user) {
dd('define isAdmin!'); // not show this message, redirect to 403 This action is unauthorized.
return $user->is_admin;
});
}
}