laravel中的gate

public function boot(){

 $this->registerPolicies();

 Gate::define('update-post',function($user,$post){

    return  $user->id == $post->user_id

})

}

$this->authorize("update',$post);

系统管理

Route::group(['middleware'=>'can:system'],function(){

扫描二维码关注公众号,回复: 4289606 查看本文章

})

/////////////////////

注册首先来自/app/providers下找到authserviceprovider.php

然后修改路由文件

最后修改模板文件就可以了

猜你喜欢

转载自www.cnblogs.com/gaosf/p/10038532.html