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(){

})

 

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

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

然后修改路由文件

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

posted @ 2018-11-29 15:19  代码堆里的看客  阅读(394)  评论(0编辑  收藏  举报