hasRole(['admin', 'winemaker']); return true; } /** * Determine whether the user can update the wine. */ public function update(User $user, Wine $wine): bool { // TODO: Implement role-based authorization // Only administrators and winemakers should be able to update wines // Example: return $user->hasRole(['admin', 'winemaker']); return true; } /** * Determine whether the user can delete the wine. */ public function delete(User $user, Wine $wine): bool { // TODO: Implement role-based authorization // Only administrators should be able to delete wines // Example: return $user->hasRole('admin'); return true; } /** * Determine whether the user can restore the wine. */ public function restore(User $user, Wine $wine): bool { // TODO: Implement role-based authorization // Only administrators should be able to restore wines // Example: return $user->hasRole('admin'); return true; } /** * Determine whether the user can permanently delete the wine. */ public function forceDelete(User $user, Wine $wine): bool { // TODO: Implement role-based authorization // Only administrators should be able to force delete wines // Example: return $user->hasRole('admin'); return true; } /** * Determine whether the user can purchase the wine. */ public function purchase(?User $user, Wine $wine): bool { // TODO: Implement purchase authorization logic // Customers and authenticated users should be able to purchase wines // Check if wine is available (status = ready and bottles_in_stock > 0) // Example: return $wine->status === 'ready' && $wine->bottles_in_stock > 0; return $wine->status === 'ready' && $wine->bottles_in_stock > 0; } }