Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何定义Laravel 6上的门_Php_Laravel_Laravel 6 - Fatal编程技术网

Php 如何定义Laravel 6上的门

Php 如何定义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

我想定义一个门,但我不知道为什么不工作,知道吗

我试图在define上显示dd(),但没有显示dd()消息,重定向到页面“403此操作未经授权。”

拉威尔6号

PHP7.3

已经看过医生了吗

这是我的AuthServiceProvider和Controller

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;
        });
    }
}