自动判断授权策略在哪里? 
                            
                                                    
                        
                    
                    
  
                    
                    刚开始发现文档中并没有,觉得很神奇,后来发现是在\Illuminate\Foundation\Auth\Access\AuthorizesRequests::resourceAbilityMap 中:
/**
 * Get the map of resource methods to ability names.
 *
 * @return array
 */
protected function resourceAbilityMap()
{
    return [
        'show' => 'view',
        'create' => 'create',
        'store' => 'create',
        'edit' => 'update',
        'update' => 'update',
        'destroy' => 'delete',
    ];
}
还是明确写比较保险。
          
                    
                    
          
          
                关于 LearnKu
              
                    
                    
                    
 
推荐文章: